Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

SOUTHERN LUZON STATE UNIVERSITY

COLLEGE OF ENGINEERING
ECE DEPARTMENT

ECE11 FEEDBACK AND CONTROL SYSTEMS LABORATORY

LABORATORY NO. 2
Mathematical Modeling of Physical Systems

GROUP # 2
Brian Aaron R. Bermudez
Bethrina Ira A. Carreon
Carloui R. Cruz
Nathaniel B. Delos Reyes
Camille Y. Dequito
Cristel Joyce M. Esmerna

BSECE III-GG
TUE 7:30 - 10:30 AM

DATE OF PERFORMANCE: March 18, 2021


DATE OF SUBMISSION: March 23, 2021

ENGR. KRIS BRYAN G. NAYNES RATING


INSTRUCTOR

This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
I. OBJECTIVES
1. To learn how to represent the mathematical models of physical systems in
MATLAB, able to grasp the learnings to solve such models which is used in design
and analysis of control systems.
2. To familiarize oneself with the functions of MATLAB on representing the
mathematical modeling of physical systems such as mass-spring system model,
were using the Linear or nonlinear ordinary differential equation as well as more
advance applications.
3. To perform Exercises 1 and 2 by creating scripts with appropriate MATLAB codes
and function by providing screenshots of the results.

II. INTRODUCTORY INFORMATION


In further studying the control system, the mathematical modeling is integral to
learn such as to be able to model a dynamic system in mathematical terms and analyze
their characteristics. A mathematical model of a system is defined as a set of equations
that represents the dynamics of the system. MATLAB offers convenient commands
and function to obtain results that can be used in analysis and design purposes.
Mathematical models may assume many different forms. Depending on the particular
system and the particular circumstances, one mathematical model may be better suited
than other models. Physical modeling includes interconnected components. For
example, in mechanical system, deriving differential equations for combination of
masses, springs and dampers to assembled to obtain the system model. This can assume
that a suitable approximation will be depending on their behavior which is
mathematically described by ordinary differential equations. These equations are in
general are often linearized about an operating point for analysis and design purposes.

III. PROCEDURES

A. Read and analyze the lecture provided for this laboratory experiment. Familiarize
oneself with the mass spring system model given in the manual which describe the
uses equation such as ODE on representing models.
B. Open MATLAB application and practice script writing with different functions and
codes for representing the mathematical modeling of physical systems such as in
mass spring and damper system which uses differential equations.
C. Perform Exercises 1 and 2 by writing the codes for each condition.
D. Run or execute the script and check if the results meet the given conditions.
E. Copy and paste the script/s and attach screenshots of the results in the Data and
Results part.

2|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
IV. DATA AND RESULTS

Exercise 1:

1. Plot the position and the speed in separate graphs.


2. Change the value of r to 2 and 3.
3. Superpose the results and compare with the linear case r=1 and plot all three cases
in the same plot window. Please use different figures for velocity and displacement.

Exercise 2:

Consider the mechanical system depicted in the figure.


The input is given by 𝑓(𝑡), and the output is given by
𝑦(𝑡). Determine the differential equation governing
the system response such that forcing function f(t)=1.
Let m = 10, k = 1, and b = 0.5. Show that the peak
amplitude of the output is about 1.8.

MATLAB Commands

Exercise 1

For r = 1
function dXdt=mass_spring(t,X)
%flow rate
M=750; %(Kg)
B=30; %(Nsec/m)
Fa=300; %N
K=15; %(N/m)
r=1;
%dX/dt
dXdt(1,1)=X(2);
dXdt(2,1)=-B/M*X(2)-K/M*X(1)^r+Fa/M;
end

For r = 2
function dXdt=mass_spring2(t2,X2)
%flow rate
MR2=750; %(Kg)
BR2=30; %(Nsec/m)
FaR2=300; %N

3|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
KR2=15; %(N/m)
r2=2;
%dX/dt
dXdt(1,1)=X2(2);
dXdt(2,1)=-BR2/MR2*X2(2)-KR2/MR2*X2(1)^r2+FaR2/MR2;
end

For r = 3
function dXdt=mass_spring3(t3,X3)
%flow rate
MR3=750; %(Kg)
BR3=30; %(Nsec/m)
FaR3=300; %N
KR3=15; %(N/m)
r3=3;
%dX/dt
dXdt(1,1)=X3(2);
dXdt(2,1)=-BR3/MR3*X3(2)-KR3/MR3*X3(1)^r3+FaR3/MR3;
end

For plotting commands


X0=[0;0]; %initial speed and position
[t,X]=ode45('mass_spring',[0 200],X0);
[t2,X2]=ode45('mass_spring2',[0 200],X0);
[t3,X3]=ode45('mass_spring3',[0 200],X0);
figure;
subplot 321;
plot(t,X(:,1));
xlabel('Time');
ylabel('Position')
grid on;
title('Mass Spring System at r=1');
subplot 322;
plot(t,X(:,2));
xlabel('Time');
ylabel('Speed');
grid on;
title('Mass Spring System at r=1');
subplot 323;
plot(t2,X2(:,1));
xlabel('Time');
ylabel('Position')
grid on;
title('Mass Spring System at r=2');
subplot 324;
plot(t2,X2(:,2));

4|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
xlabel('Time');
ylabel('Speed');
grid on;
title('Mass Spring System at r=2');
subplot 325;
plot(t3,X3(:,1));
xlabel('Time');
ylabel('Position')
grid on;
title('Mass Spring System at r=3');
subplot 326;
plot(t3,X3(:,2));
xlabel('Time');
ylabel('Speed');
grid on;
title('Mass Spring System at r=3');

Exercise 2

For f(t)=1

function dXdt=mechanical_system(t,X)
%flow rate
M=10; %Kg
B=0.5; %(Nsec/m)
Fa=1; %N
K=1; %(N/m)
r=1;
%dX/dt
dXdt(1,1)=X(2);
dXdt(2,1)=-B/M*X(2)-K/M*X(1)^r+Fa/M;
end

For the transfer function

%differential equation of the system


num=1;
den=[10 0.5 1];
sys=tf(num,den)
step(sys)

For plotting commands


X0=[0;0]; %initial speed and position
[t,X]=ode45('mechanical_system',[0 200],X0);
figure;
plot(t,X);

5|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
xlabel('Time');
ylabel('Amplitude');
title('Time Response');
grid on;

Results

Exercise 1

6|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
Exercise 2

7|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
V. SUMMARY AND CONCLUSION

In the experiment 2 about the mathematical modeling of physical system, we


were task to analyze the mass-spring system model given by the module and use
appropriate codes to satisfy the criteria in exercises 1 and 2 using MATLAB operation
and functions. For Exercise 1, is to plot the position and speed in the separate graph of
a mass-spring system where the value of r is changed to 2 and 3 and using linear
differential equation or ODE to super pose the result and compare the linear case where
the value of r is 1. To solve this exercise, we used the given function provided by the
module and create a MATLAB function in this case we used the ode45 solver for mass-
spring system where it derives differential equations for mass, force, and other variable
. The MATLAB ODE solvers are able to solve linear or nonlinear ODE’s which can be
used as another approach to solve a linear ODE differently. The Higher order systems
can also be solved similarly. For this case, we decompose the first order differential
equation which has has variables x(t) and dx(t)/dt. Since ode45 can only solve first
order differential equations, so we have to make them two first order equations. The
variables are assigned into new variables which has been assigned differential equation
for simplification will lead them into a vector which can be rewritten as in terms of
dX/dt. The function dXdt = mass_spring(t, X) will be called to the function for the
system to be plotted. The coefficients such as mass, damping coefficient, force, spring
constant are given and the value of r will be changed. The spring system in the code
will be solved in the equation and plotted. As we observed in the plot for the graph of
the position and speed from r=1 to r=3. As the value of r increases, the waveform will
be compressed.
For the exercise 2, is to determine the peak amplitude of the figure of the mass
spring system with the given m = 10, k =1 and b = 0.5. The function used and the
equation are similar to exercise 1 in which have mass, damping coefficient, spring
constant and the r. Using the transfer function, we can be able to solve the mass-spring
damper system using laplace transform and can be evaluated into a vector form, we
used the function num=1; den=[10 0.5 1]; where num and den are vector representation
for numerator and denominator and the function sys=tf(num,den) which represent the
transfer function from x(t) to x(s). After been solved, we plot and able to obtain the
peak amplitude of 1.8.

8|Page
This study source was downloaded by 100000838733379 from CourseHero.com on 11-09-2022 03:13:04 GMT -06:00

https://www.coursehero.com/file/86296454/ECE11L-CRUZ-CARLOUI-Group2-Lab-2pdf/
Powered by TCPDF (www.tcpdf.org)

You might also like