Feedcs Exp2
Feedcs Exp2
Feedcs Exp2
NAME OF STUDENT:
GROUP NUMBER: DATE PERFORMED:
COURSE CODE: DATE SUBMITTED:
COURSE TITLE: YEAR AND SECTION:
LAB. INSTRUCTOR: GRADE:
SIMULAB NO.2
Objectives: The objective of this exercise is to grasp the important role mathematical models
of physical systems in the design and analysis of control systems. We will learn
how MATLAB helps in solving such models.
List of Equipment/Software
MATLAB
Deliverables
Consider the following Mass-Spring system shown in the figure. Where Fs(x) is the spring force,
Ff( ̇ ) is the friction coefficient, x(t) is the displacement and Fa(t) is the applied force:
Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 1
Control Systems
Where
and
( )
( ) ( ) ( )
( )
( )
The differential equation for the above Mass-Spring system can then be written as follows
( ) ( )
The linear differential equation of second order (2) describes the relationship between the
displacement and the applied force. The differential equation can then be used to study the time
behavior of x(t) under various changes of the applied force. In reality, the spring force and/or the
Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 2
Control Systems
friction force can have a more complicated expression or could be represented by a graph or data
table. For instance, a nonlinear spring can be designed such that
( )
Where r > 1.
( ) ( )
Equation (3) represents another possible model that describes the dynamic behavior of the mass-
damper system under external force. Model (2) is said to be a linear model whereas (3) is said to
be nonlinear. To decide if a system is linear or nonlinear two properties have to be verified
homogeneity and superposition.
Assignment: use homogeneity and superposition properties to show that model (1) is linear
whereas model (3) is nonlinear.
The solution of the difference equations (1), (2), or (3) leads to finding subject to certain
initial conditions.
MATLAB can help solve linear or nonlinear ordinary differential equations (ODE). To show
how you can solve ODE using MATLAB we will proceed in two steps. We first see how can we
solve first order ODE and second how can we solve equation (2) or (3).
Assume the spring force which means that K=0. Equation (2) becomes
( )
Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 3
Control Systems
Or
( )
2_ function dvdt=cruise_speed(t, v)
crea %flow rate
te a
new M=750; %(Kg)
MA B=30; %( Nsec/m)
TL
AB Fa=300; %N
m- % dv/dt=Fa/M-B/M v
file
and dvdt=Fa/M-B/M*v;
writ
e
There are many other MATLAB ODE solvers such as ode23, ode45, ode113, ode15s, etc… The
function dsolve will result in a symbolic solution. Do ‘doc dsolve’ to know more. In MATLAB
write
>>dsolve(‘Dv=Fa/M-B/M*v’, ‘v(0)=0’)
Note that using MATLAB ODE solvers are able to solve linear or nonlinear ODE’s. We will see
in part II of this experiment another approach to solve a linear ODE differently. Higher order
systems can also be solved similarly.
Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 4
Control Systems
( )
The second order differential equation has to be decomposed in a set of first order differential
equations as follows
[ ]
Function dXdt=mass_spring(t, X)
2_
in %flow rate
MA M=750; %(Kg)
TL
AB B=30; %( Nsec/m)
writ Fa=300; %N
e
K=15; %(N/m)
>>
r=1;X0=[0; 0]; %(initial speed and position)
>> options = odeset('RelTol',[1e-4 1e-4],'AbsTol',[1e-5 1e-5],'Stats','on');
% dX/dt
>>[t,X]=ode45('mass_spring',
dXdt(1,1)=X(2); [0 200],X0);
dXdt(2,1)=-B/M*X(2)-K/M*X(1)^r+Fa/M;
Exe
Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 5
Control Systems
rcise 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 f(t), and the output
is given by y(t). Determine the differential
equation governing the system and using
MATLAB, write a m-file and plot 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.
Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 6