Sei sulla pagina 1di 8

Mapúa Institute of Technology

School of Mechanical and Manufacturing Engineering

ME153P/B1
CONTROL SYSTEM ENGINEERING

WRITTEN REPORT ON
MATLAB

EXERCISES 1 TO 3

SUBMITTED BY:
CALIWLIW, JANTZEN BRIX P.
2014100354

SUBMITTED TO:

ENGR. PAULO RAFAEL V. MERIS

DATE: JUNE 13, 2017

i
ABSTRACT:
Today’s exercises made use of Matlab. Matlab, similar to that of Scilab, performs
calculation, visualization through graphs, and as well as programming. Several exercises were
accomplished and that includes to create a graphical user interface of temperature converter, a
graphical user interface of vibration of a spring-mass constant that graphs the input values set by
the user, and a graphical user interface of the parametric equations that graphs the input values as
well. Components that were mainly used were edit text, static text, push button, and axes. Edit text
are used for typing data when the program is running; static text on the other hand does not allow
such, it only displays “string”; push button allows you to control tunable parameters and variables
in your model during simulation; and axes shows the graph of the model. These exercises are
helpful in several field since it enables you to visualize and analyze on how to create a GUI for
different problems encountered that would make your life way easier.

GENERAL OBJECTIVES:

1. To create GUIs in order to solve specific engineering problems using MATLAB


2. To be familiar with some basic GUI programming commands
3. To apply concepts in mathematics and engineering in creating GUI

ii
TABLE OF CONTENTS

TITLE PAGE i
ABSTRACT ii
GENERAL OBJECTIVES ii
TABLE OF CONTENTS iii
EXERCISE NO. 1: Temperature conversion 4
Problem Statement 4
Objective 4
Solution 4
Discussion 5
Conclusion 5
EXERCISE NO. 2: Vibration of a spring-mass system 5
Problem Statement: 5
Objective 6
Solution 6
Discussion 6
Conclusion 7
EXERCISE NO. 3: Parametric Equations of motion 7
Problem Statement 7
Objective 7
Solution 7
Discussion 7
Conclusion 8
REFERENCES 8
.

iii
EXERCISE NO. 1: Temperature Conversion

Problem Statement:
In several industries including healthcare, mechanical and manufacturing industry, etc.
there is a need for a data acquisition system that involves measurement of temperatures. This
system should be able to convert one temperature scale to another since it is much needed in
analysis.
The students are asked to create a similar GUI shown below.

Figure 1. Temperature scale GUI

Objective
The objective of this exercise is to create a graphical user interface that can convert the
Celsius temperature scale to other temperature scales such as Fahrenheit, Kelvin, and Rankine.

Solution
F = 1.8 * C + 32;
K = C + 273;
R = F + 460;
C = str2double (get(handles.edit2, 'string'));
set(handles.text15, 'string',F);
set(handles.text16, 'string',K);
set(handles.text17, 'string',R);

4
Discussion
Millions and thousands of engineers and scientist use Matlab. Matlab is essential in
several industries and fields since it can compute, visualize through graphs, and program as well.
Problems and solutions are expressed in mathematical notation making it a convenient to use.

In creating a graphical user interface (GUI) that converts Celsius to several temperature
scales, several components were used, that includes: static text, edit text, and a push button. Static
Text is used to display “string” such as words, numbers etc. Edit text, on the other hand, is used
for typing inputs, that will be processed by the push button. The formula used were given and
every engineering student should at least be familiar with that. The word “C” is used to denote for
Celsius temperature scale. Anything number input on the system will be read in terms of Celsius
degree. “Set” here is used to specify a value for the property on the object identified. Therefore,
after the program performs computation, the values are shown in designated static texts.

Conclusion
The students were able to comply with the objective of this exercise. They were able to
create a GUI that converts Celsius to Fahrenheit, Rankine, and Kelvin with ease and understanding.
This is the first time they used Matlab since it has not been taught during their stay in Mapua. It is
only Scilab that has been taught under the course of Math16. These components were used are
essential for the succeeding exercises since they are asked to create a GUI for different problems.

EXERCISE NO. 2: Vibration of a Spring-Mass System

Problem Statement:
Vibration is defined as a phenomenon in which oscillations occur about an equilibrium
point. Thus, there is a need for a program that can analyze such since if analyzation is done
manually, it would take too much time. The students are asked to create a similar GUI shown
below. /

Figure 2. Vibration of Spring-Mass System GUI

5
Objectives
The students are asked to create a GUI for a vibration of spring mass system. The GUI
should show the graph of the input values.
Solution
m=str2double(get(handles.edit1,'String'));
k=str2double(get(handles.edit2,'String'));
s=str2double(get(handles.edit3,'String'));
L=str2double(get(handles.edit4,'String'));
v=str2double(get(handles.edit5,'String'));
t1=str2double(get(handles.edit6,'String'));
t2=str2double(get(handles.edit7,'String'));
x=t1:0.1: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(handles.axes1,x,y);

Discussion
Several variables were introduced that includes mass (m), spring constant (k), initial
position (s), unstretched length (L), initial velocity (v), lower time limit (t1), and upper time limit
(t2). The students used the same components from the previous exercise including push buttons,
edit texts, static texts. Several modifications have been made including the upper and lower limits
of the independent variable with a step-size of 0.1. The function of plot here is to create a 2-D line
plot of the input values in Y versus the corresponding values of X.

The figure below shows the graph of the vibration of a spring-mass system considering
the input values typed below.

Figure 3. Graph of the vibration of a spring-mass system considering the input data

6
Conclusion
The students were able to create a GUI of the vibration of a spring-mass system. Further
explanations from the vibration of a spring-mass system is discussed on the course: Vibration
Engineering since Math24-1 just simply gave a glimpse of it. It is expected that several components
from the previous exercise and this exercise are alike. However, modifications has to be made in
order to cope up with the objectives of this exercise.

EXERCISE NO. 3: Parametric Equations of Motions

Problem Statement:
The coordinates of a point (x,y) on a curve are often expressed in terms of a third variable
(t). Thus:
𝑥 = 𝑓(𝑡) 𝑦 = ℎ(𝑡)
The third variable is called the parameter and the two equations are the parametric
equations of the curve. A particle under curvilinear motion can be separated into rectangular
components. The graph of these rectangular components seems to be inefficient since the analysis
to be made is three: that is the positions x,y,z as a function of time.

Objectives
To create a GUI that can graph the positions x,y,z as a function of time.

Solution
a=str2double(get(handles.edit2,'String'));
b=str2double(get(handles.edit3,'String'));
t1=str2double(get(handles.edit4,'String'));
t2=str2double(get(handles.edit5,'String'));
t=t1:0.1:t2;
x=sin(a*t);
y=cos(a*t);
z=exp(b*t);
plot(handles.axes1,t,x);
plot(handles.axes2,t,x);
plot(handles.axes3,t,z);

Discussion
Still, several components used in the previous exercises were used in this exercise that
includes, static texts, edit texts, push buttons, and axes. In this exercise, the particle undergone a
curvilinear motion. Thus, a graphical user interface has been made in order to transform such
curvilinear into rectangular motion. The rectangular coordinates, x, y, and z was graph against
function of time. Thus, it should show results that time is the independent variable whilst x, y, and
z are the dependent variables.

The figure below shows the graph of positions x, y, z plotted against time with the input
data set by the student.
7
Figure 4. Graph of positions x,y,z against t with input values set by the student

Conclusion
The objective of this exercise was completed. The students were able to broken down the
particle’s curvilinear motion into its rectangular components by making a GUI of it. The
knowledge from the previous exercises were applied to this exercise since the processes are almost
the same. This GUI is helpful in students studying physics in analyzing the behavior of a particle
when the abrupt changes causes it to curvilinear motion.

References
 Mathlab Documentation. 2017. Accessed June 13, 2017.
https://www.mathworks.com/help/matlab/.
 Vibration. 2017. Accessed June 13, 2017.
https://en.wikipedia.org/wiki/Vibration

Potrebbero piacerti anche