0% found this document useful (0 votes)
123 views

Me160 Experiment No. 2 Matlab Gui

The document describes experiments conducted using MATLAB GUI (Graphical User Interface) tools. It includes 5 sections: 1) Theories and principles on temperature conversion, vibration of a spring-mass system, parametric equations of motion, pump performance curves, and nodal temperature. 2) A discussion of how GUIs could be used to solve problems related to each topic in a more efficient manner than manual methods. 3) Sample problems that could be solved with the GUIs. 4) Preliminary and final data sheets describing the GUI setup and functions. 5) Conclusions that the GUIs allow interactive and user-friendly solutions to engineering problems.

Uploaded by

Dikimbie Gatpu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

Me160 Experiment No. 2 Matlab Gui

The document describes experiments conducted using MATLAB GUI (Graphical User Interface) tools. It includes 5 sections: 1) Theories and principles on temperature conversion, vibration of a spring-mass system, parametric equations of motion, pump performance curves, and nodal temperature. 2) A discussion of how GUIs could be used to solve problems related to each topic in a more efficient manner than manual methods. 3) Sample problems that could be solved with the GUIs. 4) Preliminary and final data sheets describing the GUI setup and functions. 5) Conclusions that the GUIs allow interactive and user-friendly solutions to engineering problems.

Uploaded by

Dikimbie Gatpu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

MAPÚA UNIVERSITY

SCHOOL OF MECHANICAL AND MANUFACTURING


ENGINEERING

ME160P-2/E01 INSTRUMENTATION AND CONTROL


ENGINEERING

WRITTEN REPORT ON:


MATLAB GUI (GRAPHICAL USER INTERFACE)

EXPERIMENT NO. 2

SUBMITTED BY:

Capulong, Shem Javan V. Macunat, Joshua Jermaine


2019141104 2019102145

Cosio, Jervin C. Mejia, Jerome Patrick F.


2020117105 2017130506

Fernandez, Tristan Jonas G. Mendoza, Aaron


2016131749 2018109854

Laysa, Christian John A. Pamittan, Edwin Jr. L.


2019104312 2019104104

Cumpio, John Derick T.


2015106684

Submitted To:
Engr. Julian Albert Nohay
October 5, 2022

ABSTRACT
Graphic User Interface is a helpful MATLAB tool case to produce envisioned user-friendly user
interfaces and configurations for data and procedures. In this conduct experiment, we utilize our
understanding of simple MATLAB coding in constructing GUIs that resolves a certain
engineering task. The outline of the GUIs is developed all through the Design App in MATLAB,
which includes mechanisms, for instance, data entry, button, table, etc., that are effortlessly
programmable to operate a particular algorithm. Some procedures are applied in creating the data
of each GUI function that we get acquainted with. Therefore, each GUI is user-friendly since it is
effortlessly reasonable due to how it is created with the intent of minimalism and functionality.

OBJECTIVE

 To create GUIs to solve specific engineering problems using MATLAB


 To be familiar with some basic GUI programming commands
 To apply concepts in mathematics and engineering in creating GUIs
TABLE OF CONTENTS
TITLE PAGE i
ABSTRACT ii
OBJECTIVE ii
TABLE OF CONTENTS iii

THEORIES AND PRINCIPLE 1


DISCUSSION 4
SAMPLE PROBLEMS 6
PRELIMINARY DATA SHEET 7
FINAL DATA SHEET / SET-UP 9

CONCLUSION 12

RECOMMENDATION 12

REFERENCES 13
THEORIES AND PRINCIPLES

Temperature Conversion

We understand that the idea of temperature is the warmth and coldness of a particular thing. But
we be able to calculate it in numerous methods and can distinguish it with the help of many
components of temperature. Celsius and Fahrenheit is the most familiar. Then next one is Kelvin,
a full sale often applied in science. The very last one is the Rankine which is utilized in
engineering techniques and can be calculated by means of Fahrenheit.

Figure 1. Boiling point and Freezing point of Water in different Scales of Temperature

Vibration of Spring-Mass System

Vibratory systems are made for storing Potential and Kinetic energy. Hence, variables such as
velocity, mass, displacement, spring constant, and unstretched length are always of use. A
famous example of this exercise is an automotive suspension system under load.
Figure 2. Simplified mass-spring model for vibration.

For this GUI, Graph block will be added to the application that will be coded by values and
formulas to show the corresponding graph for the corresponding values.

Parametric Equation of Motions

A parametric equation defines a group of quantities as functions of one or more independent


variables called parameters. Parametric equations are commonly used to express the coordinates
of the points that make up a geometric object such as a curve or surface, in which case the
equations
are collectively called a parametric representation or parameterization of the object. In addition
to
curves and surfaces, parametric equations can describe manifolds and algebraic varieties of
higher
dimension, with the number of parameters being equal to the dimension of the manifold or
variety,
and the number of equations being equal to the dimension of the space in which the manifold or
variety is considered.
Figure 3. Parametric Equation Curve

Pump Performance Curve

Pump performance curves are valuable sketches created by the pump producer. Pump
presentation curves are largely applied to forecast the difference of the discrepancy head across
the pump, as the flow is shifted. Moreover, difference of effectiveness, power, NPSH expected
etc., as the flow is adjusted, can also be characterized on the pump performing curves by the
producer.

Figure 4. Pump Performance Curves


Nodal Temperature

A temperature can be applied to nodes, surfaces, or parts in a model. A


surface temperature applies nodal temperatures to each node on the surface, and a
part temperature applies nodal temperatures to each node in the part. A temperature is used for a
thermal stress analysis.

Figure 5. Nodal Temperature on thermal stress analysis

DISCUSSION

Temperature Conversion

A data acquisition system for equipment maintenance involves the measurement of temperature
in degree Celsius. However, conversions to different temperature scales are needed in the data
analysis.

The formula that will be used:

TF = 1.8TC + 32

TK = TC + 273

TR = TF +460

Where:

TF: Temperature in Fahrenheit


TC: Temperature in Celsius

TR: Temperature in Rankine

TK: Temperature in Kelvin

Figure 6. Temperature conversion GUI

Vibration of Spring-Mass System

Vibration in spring-mass system can be analyzed by plotting the equation that can
describe its displacement. If manual graphing will be applied, the process will be time-
consuming.

The formula that will be used:


y = 1+(((s-1)^2+((v^2)*m/k))^(½))*sin(((k/m)^(½))*x+atan((s-1)*((k/m)^(½))/v))

where:
y: displacement (m)
L: unstretched length (m)
s: initial position (m)
v: initial velocity (m/s)
k : spring constant (N/m)
m: mass (kg)
Figure 7. Vibration of Spring-Mass System GUI

Parametric Equations of Motions

The position of the particle under curvilinear motion can be separated into rectangular
components. By viewing the graphs for each component as a function of time, the positions x, y
& z can be studied. However, plotting each component one at a time will be inefficient.

To program properly the GUI, the following formulas were used:

a = app.AEditField.Value;

b = app.BEditField.Value;

t1 = app.LowerEditField.Value;

t2 = app.UpperEditField.Value;

t = t1:0.01:t2;

x = sin(a*t);

y = cos(a*t);

z = exp(b*t);

plot(app.UIAxesSin,t,x);

plot(app.UIAxesCos,t,y);
loglog(app.UIAxesExp,t,z);

where:
x = is where the sine values are plotted
y = is where the cosine values are plotted
z = is where the exponential values are plotted

Figure 8. Parametric Equations of Motions GUI

Pump Performance Curve

A pump performance curve can be used to estimate the pump head, power, efficiency and
Net Positive Suction Head Required (NPSHR) for operation if the flowrate is known.
Unfortunately, consulting the curve (figure 7) for the values is time-consuming and inconvenient.

For the programming, the following formula will be used:

H = 36.8-(2*10^-4)*(Q-40000)-(8*10^-9)*(Q-40000)*(Q-42500)-(5.3333*10^-
12)*(Q40000)*(Q-42500)*(Q-45000)+(8.5333*10^-16)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)- (1.024*10^-19)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)+(1.2516*10^-23)*(Q40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-
52500)-(1.5279*10^-27)*(Q40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-
52500)*(Q-55000)+(1.6091*10^- 31)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)*(Q-52500)*(Q-55000)*(Q57500)-(1.3653*10^-35)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)*(Q52500)*(Q-55000)*(Q-57500)*(Q-60000);
N = 79.52+(1.192*10^-3)*(Q-40000)-(5.726*10^-8)*(Q-40000)*(Q-
42500)+(3.9467*10^- 12)*(Q-40000)*(Q-42500)*(Q-45000)-(6.9333*10^-16)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q47500)+(7.68*10^-20)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)-(8.4764*10^- 24)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)+(1.0305*10^-27)*(Q40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)*(Q-55000)-(1.1789*10^- 31)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q57500)+(1.3037*10^-35)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q52500)*(Q-55000)*(Q-
57500)*(Q-60000);
P = 5190.476+(2.8572*10^-2)*(Q-40000)-(3.8096*10^-6)*(Q-40000)*(Q-
42500)+(3.5557*10^- 10)*(Q-40000)*(Q-42500)*(Q-45000)-(9.1431*10^-14)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q47500)+(1.8286*10^-17)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)- (2.5736*10^-21)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q52500)+(2.6316*10^-25)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q52500)*(Q-55000)-(1.9118*10^-29)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q50000)*(Q-52500)*(Q-55000)*(Q-57500)+(7.4991*10^-34)*(Q-
40000)*(Q-42500)*(Q45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-
57500)*(Q-60000);
NPSHR = 13.33-(1.4*10^-4)*(Q-40000)-(8*10^-10)*(Q-40000)*(Q-
42500)+(1.3867*10^- 12)*(Q-40000)*(Q-42500)*(Q-45000)-(2.6667*10^-16)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q47500)+(4.1813*10^-20)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)- (4.1529*10^-24)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q52500)+(2.3731*10^-28)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q52500)*(Q-55000)-(3.25089*10^-34)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q50000)*(Q-52500)*(Q-55000)*(Q-57500)-(1.5821*10^-36)*(Q-
40000)*(Q-42500)*(Q45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-
57500)*(Q-60000);

Where:
Q: flowrate (cu. m/h)
H: Output head (m)
N: Pump Efficiency (%)
P: Power (KW)

NPSHR: Net Positive Suction Head Required (m)


SAMPLE PROBLEMS
Exercise no.1: Temperature Conversion: Create a GUI that converts Temperature from
Celsius into Fahrenheit, Kelvin and Rankine and display it into a table.
Exercise no.2: Vibration of Spring-Mass System: Create an GUI that plots a
displacement graph with the given corresponding values of variables.
Exercise no.3: Parametric Equations of Motions: Create a GUI that can plot each
component with x, y, and z as a function of time. It should show the graphical plot of x and y.
Exercise no.4: Pump Performance Curve: To create a GUI that graphs pump performance
to predict the variation of differential head across the pump.
Exercise no.5: Nodal Temperatures: Create a GUI the solves the Nodal Temperature with
Thermal Conductivity and a direction-based Temperature as an input. It should also display
the energy used on each direction.
PRELIMINARY DATA SHEET
FINAL DATA SHEET / SET-UP

Temperature Conversion

%Button pushed function: GraphButton

function GraphButtonPushed(app,event)

C = app.TemperatureCEditField.Value

if C >= -273

msgbox(“Error Temp Input’)

end

F = C * 1.8 + 32;

K = C + 273;

R = F + 460;

tempTable = {F K R};

app.UITable.Data = tempTable

Figure 11. Temperature conversion results.


Vibration of Spring-Mass System

%Button pushed function: GraphButton

function GraphButtonPushed(app,event)

m = app.MasskEditField.Value;

s = app.StiffnessNmEditField.Value;

k = app.InitialPositionmEditField.Value;

l = app.UnstretchedLengthmEditField.Value;

v = app.InitialVelocitymsEditField.Value;

t1 = app.Time1EditField.Value;

t2 = app.Time2EditField.Value;

x = t1:0.01:t2;

y = 1+(((s-1)^2+((v^2)*m/k))^(1/2))*sin(((k/m)^(1/2))*x+atan((s-1)*((k/m^1/2))/v));

plot(app.UIAxesVSMS,x,y);

end

end

Figure 11. Vibration spring-mass system results.


Parametric Equations of Motions

%Button pushed function: GraphButton

function GraphButtonPushed(app,event)

a = app.AEditField.Value;

b = app.BEditField.Value;

t1 = app.LowerEditField.Value;

t2 = app.UpperEditField.Value;

t = t1:0.01:t2;

x = sin(a*t);

y = cos(a*t);

z = exp(b*t);

plot(app.UIAxesSin,t,x);

plot(app.UIAxesCos,t,y);

loglog(app.UIAxesExp,t,z);

end

end
Figure 12. Parametric Equations of Motions result
Pump Performance

if Q>=40000 && Q<=62500


outputhead = 36.8-(2*10^-4)*(Q-40000)-(8*10^-9)*(Q-40000)*(Q-42500)-
(5.3333*10^-12)*(Q-40000)*(Q-42500)*(Q-45000)+(8.5333*10^-16)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)-(1.024*10^-19)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)+(1.2516*10^-23)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-52500)-
(1.5279*10^-27)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-
55000)+(1.6091*10^-31)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-
52500)*(Q-55000)*(Q-57500)-(1.3653*10^-35)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)*(Q-60000);
pumpefficiency = 79.52+(1.192*10^-3)*(Q-40000)-(5.726*10^-8)*(Q-
40000)*(Q-42500)+(3.9467*10^-12)*(Q-40000)*(Q-42500)*(Q-45000)-(6.9333*10^-16)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q-47500)+(7.68*10^-20)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)-(8.4764*10^-24)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)*(Q-52500)+(1.0305*10^-27)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)*(Q-52500)*(Q-55000)-(1.1789*10^-31)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)+(1.3037*10^-35)*(Q-40000)*(Q-
42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)*(Q-60000);
power = 5190.476+(2.8572*10^-2)*(Q-40000)-(3.8096*10^-6)*(Q-
40000)*(Q-42500)+(3.5557*10^-10)*(Q-40000)*(Q-42500)*(Q-45000)-(9.1431*10^-14)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q-47500)+(1.8286*10^-17)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)-(2.5736*10^-21)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)+(2.6316*10^-25)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)*(Q-55000)-(1.9118*10^-29)*(Q-40000)*(Q-42500)*(Q-
45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)+(7.4991*10^-34)*(Q-
40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)*(Q-
60000);
NPSHR = 13.33-(1.4*10^-4)*(Q-40000)-(8*10^-10)*(Q-40000)*(Q-
42500)+(1.3867*10^-12)*(Q-40000)*(Q-42500)*(Q-45000)-(2.6667*10^-16)*(Q-40000)*(Q-
42500)*(Q-45000)*(Q-47500)+(4.1813*10^-20)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)-(4.1529*10^-24)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)*(Q-52500)+(2.3731*10^-28)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-47500)*(Q-
50000)*(Q-52500)*(Q-55000)-(3.25089*10^-34)*(Q-40000)*(Q-42500)*(Q-45000)*(Q-
47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)-(1.5821*10^-36)*(Q-40000)*(Q-
42500)*(Q-45000)*(Q-47500)*(Q-50000)*(Q-52500)*(Q-55000)*(Q-57500)*(Q-60000);
pumpTable = {outputhead pumpefficiency power NPSHR};
app.UITable.Data = pumpTable;
else
msgbox('Error:Flow Rate Value.')
end
Nodal Temperature

Ta = app.TempaEditField.Value;
Tb = app.TempbEditField.Value;
Tc = app.TempcEditField.Value;
Td = app.TempdEditField.Value;
k = app.ThermalConductivitykEditField.Value;
x = [-4,1,0,1,0,0,0,0,0;1,-4,1,0,1,0,0,0,0;0,1,-4,0,0,1,0,0,0;1,0,0,-
4,1,0,1,0,0;0,1,0,1,-4,1,0,1,0;0,0,1,0,1,-4,0,0,1;0,0,0,1,0,0,-4,1,0;0,0,0,0,1,0,1,-
4,1;0,0,0,0,0,1,0,1,-4];
y = [-Ta-Tb;-Tb;-Tb-Tc;-Ta;0;-Tc;-Ta-Td;-Td;-Tc-Td];
z = x\y;
T1 = z(1,1);
T2 = z(2,1);
T3 = z(3,1);
T4 = z(4,1);
T5 = z(5,1);
T6 = z(6,1);
T7 = z(7,1);
T8 = z(8,1);
T9 = z(9,1);
Qleft = k*(3*Ta-T1-T4-T7);
Qup = k*(3*Tb-T1-T2-T3);
Qright = k*(3*Tc-T3-T6-T9);
Qdown = k*(3*Td-T7-T8-T9);
Checking = Qleft + Qright + Qup + Qdown;
app.UITableTempA.Data = {T1 T2 T3};
app.UITableTempA_2.Data = {T4 T5 T6};
app.UITableTempA_3.Data = {T7 T8 T9};
app.UITableQCheck.Data = {Qleft Qright Qup Qdown Checking};
CONCLUSION

We learned the fundamentals of MATLAB through the five exercises we created. Basics, for
example, incorporate callbacks, building blocks like tables, axes, and lists, into comprehending a
variety of controls and scripts to produce a usable software. Therefore, not only are the groups of
tasks a good way to appreciate the App designer tool, but they also encourage one to think
carefully about fundamental measurable concepts like temperature converters, equations of
motion, Hooke's law, and, finally, nodal temperatures.
RECOMMENDATION

It is important for a GUI's design to be appealing to the eye and simple enough for a novice user
to understand. By adding labels and extra visual elements, make sure it is easily understandable.
Don't emphasis the layout too much, which means that for most of the section, you must remain
straightforward. Decide what your program is going to resolve and its goal before beginning the
encryption process. Investigate thoroughly to pinpoint the issue so that you can put the code
more effectively. To sum up, make sure you are proficient with MATLAB controls because they
are essential.

You might also like