Feedcs Exp2

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

Control Systems

ANGELES UNIVERSITY FOUNDATION


College of Engineering and Architecture
Computer Engineering Department

NAME OF STUDENT:
GROUP NUMBER: DATE PERFORMED:
COURSE CODE: DATE SUBMITTED:
COURSE TITLE: YEAR AND SECTION:
LAB. INSTRUCTOR: GRADE:

SIMULAB NO.2

Mathematical Modeling of Physical Systems

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

Following equipment/software is required:

 MATLAB

Deliverables

A complete lab report including the following:

 Summarized learning outcomes.


 MATLAB scripts and their results for all the assignments and exercises should be
properly reported.

Mass-Spring System Model

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

( )

According to the laws of physics

( ) ( ) ( )

In the case where:

( )

( )

The differential equation for the above Mass-Spring system can then be written as follows

( ) ( )

B is called the friction coefficient and K is called the spring constant.

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.

In such case, (1) becomes

( ) ( )

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.

Solving the differential equation using MATLAB:


The objectives behind modeling the mass-damper system can be many and may include

 Understanding the dynamics of such system


 Studying the effect of each parameter on the system such as mass M, the friction
coefficient B, and the elastic characteristic Fs(x).
 Designing a new component such as damper or spring.
 Reproducing a problem in order to suggest a solution.

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).

Speed Cruise Control example:

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

( )

Equation (5) is a first order linear ODE.

Using MATLAB solver ode45 we can write do the following:

1_ create a MATLAB-function cruise_speed.m

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

v0= 0; %(initial speed)


[t,v]=ode45('cruise_speed', [0 125],v0);
plot(t,v); grid on;
title('cruise speed time response to a constant traction force Fa(t) ')

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.

Mass-Spring System Example:

Prepared by: Wilbert M. Llanos, MSECE & Cirilo C. Calibjo, Ph.D. Page 4
Control Systems

Assume the spring force . The mass-spring damper is now equivalent to

( )

The second order differential equation has to be decomposed in a set of first order differential
equations as follows

Variables New variable Differential equation

In vector form, let [ ]; [ ] then the system can be written as

[ ]

The ode45 solver can now be used:

1_ create a MATLAB-function mass_spring.m

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

You might also like