Experiment # 3 Mathematical Modelling and Simulation of Mechanical Systems
Experiment # 3 Mathematical Modelling and Simulation of Mechanical Systems
Experiment # 3
Mathematical Modelling and Simulation of Mechanical Systems
3.0 Objective
i. The objective of this experiment is to simulate a second order mass-spring
system and study its behaviour
3.2 Background
3.3 Mechanical system
A mechanical system is any group of objects that interact based on basic mechanical principles. The
basic mechanical system comprise of three basic components which are as follows:
1. Mass
2. Damper
3. Spring
Mass–spring–damper
The free body diagram for this system is shown below. The spring force is proportional to the
displacement of the mass, , and the viscous damping force is proportional to the velocity of the
mass, . Both forces oppose the motion of the mass and are therefore shown in the negative
-direction. Note also, that corresponds to the position of the mass when the spring is
unstretched.
1
Control Systems Lab FURC Department of Electrical Engineering
Now we proceed by summing the forces and applying Newton’s second law, Eq. (11), in each
direction of the problem. In this case, there are no forces acting in the -direction; however, in
the -direction we have:
This equation, known as the governing equation, completely characterizes the dynamic state of
the system. Later, we will see how to use this to calculate the response of the system to any
external input, , as well as analyze system properties such as stability and performance.
To determine the state-space representation of the mass-spring-damper system, we must reduce
the second order governing equation to a set of two first order differential equations. To this end,
we choose the position and velocity as our state variables.
Note also that these state variables correspond to the potential energy in the spring and the
kinetic energy of the mass respectively. Often when choosing state variables it is helpful to
consider the independent energy storage elements in the system.
The state equation in this case is as follows:
If, for instance, we are interested in controlling the position of the mass, then the output equation
is as follows:
Now we will show you how to enter the equations derived above into a m-file for MATLAB.
Let's assign numerical values to each of the variables.
m mass 1.0 kg
2
Control Systems Lab FURC Department of Electrical Engineering
k = 1;
b = 0.2;
F = 1;
A = [0 1; -k/m -b/m];
B = [0 1/m]';
C = [1 0];
D = [0];
sys = ss(A,B,C,D)
sys =
a =
x1 x2
x1 0 1
x2 -1 -0.2
b =
u1
x1 0
x2 1
3
Control Systems Lab FURC Department of Electrical Engineering
c =
x1 x2
y1 1 0
d =
u1
y1 0
The Laplace transform for this system assuming zero initial conditions is
and therefore the transfer function from force input to displacement output is
Now we will show how to enter the transfer function derived above into MATLAB. Enter the
following commands into the m-file in which you defined the system parameters.
s = tf('s');
sys = 1/(m*s^2+b*s+k)
sys =
4
Control Systems Lab FURC Department of Electrical Engineering
---------------
s^2 + 0.2 s + 1
Note that we have used the symbolic s variable here to define our transfer function model. We
recommend using this method most of the time; however, in some circumstances, for instance in
older versions of MATLAB or when interfacing with SIMULINK, you may need to define the
transfer function model using the numerator and denominator polynomial coefficients directly. In
these cases, use the following commands:
num = [1];
den = [m b k];
sys = tf(num,den)
sys =
---------------
s^2 + 0.2 s + 1
5
Control Systems Lab FURC Department of Electrical Engineering
Lab Exercise
Q#1
We consider here a simple model of the vehicle dynamics, shown in the free-body diagram
(FBD) above. The vehicle, of mass m, is acted on by a control force, u. The force u represents
6
Control Systems Lab FURC Department of Electrical Engineering
the force generated at the road/tire interface. For this simplified model we will assume that we
can control this force directly and will neglect the dynamics of the power terrain, tires, etc., that
go into generating the force. The resistive forces, bv, due to rolling resistance and wind drag, are
assumed to vary linearly with the vehicle velocity, v, and act in the direction opposite the
vehicle's motion. Vehicle mass (m) is 1000 kg and damping coefficient (b) is 50 N.s/m.
Calculate the transfer function for the above system. Also calculate the step response and pole
zero map of the system. You can use pzmap function for pole-zero map.