Lab 06 PDF
Lab 06 PDF
Section: …………………………………………………………
Remarks: …………………………………………………
List of Equipment/Software
Following equipment/software is required:
MATLAB
Personal Computer
The differential equation for the above Mass-Spring system can be derived as follows
𝑑2 𝑥(𝑡) 𝑑𝑥(𝑡)
𝑀 +𝐵 + 𝐾𝑥(𝑡) = 𝐹𝑎 (𝑡)
𝑑𝑡 2 𝑑𝑡
Transfer Function:
Applying the Laplace transformation while assuming the initial conditions are zeros, we get
(𝑀𝑠 2 + 𝐵𝑠 + 𝐾) ∗ 𝑋(𝑠) = 𝐹𝑎 (𝑠)
Then the transfer function representation of the system is given by
𝑂𝑢𝑡𝑝𝑢𝑡 𝐹𝑠 (𝑠) 1
𝑇𝐹 = = = 2
𝐼𝑛𝑝𝑢𝑡 𝑋(𝑠) (𝑀𝑠 + 𝐵𝑠 + 𝐾)
A useful trick is to create the Laplace variable, s. That way, you can specify polynomials
using s as the polynomial variable.
>>s=tf('s');
>>sys= s/(s^2 + 2*s + 1)
Transfer function:
s
-------------
s^2 + 2 s + 1
This is identical to the previous transfer function.
0.776 s (s-1)
--------------------
(s+1) (s+3) (s+0.28)
pzmap(sys)
pzmap(sys1,sys2,...,sysN)
[p,z] = pzmap(sys)
Description:
pzmap(sys) plots the pole-
zero map of the continuous- or
discrete-time LTI model sys. For
SISO systems, pzmap plots the
transfer function poles and zeros. The
poles are plotted as x's and the zeros
are plotted as o's.
pzmap(sys1,sys2,...,sysN)
plots the pole-zero map of several LTI
models on a single figure. The LTI
models can have different numbers of
inputs and outputs. When invoked
with left-hand arguments, [p, z] =
pzmap(sys) returns the system poles
and zeros in the column vectors p and
z. No plot is drawn on the screen. You
can use the functions sgrid or zgrid to
plot lines of constant damping ratio
and natural frequency in the s-plane or
z-plane.
Example:
2𝑠 2 + 5𝑠 + 1
𝐻(𝑠) = 2
𝑠 + 2𝑠 + 3
For example:
Time-interval specification:
To contain the response of the system you
can also specify the time interval to
simulate the system too.
For example,
>> t = 0:0.01:10
>> impulse(H,t)
Or
>> step(H,t)
First generate the square wave with gensig. Sample every 0.1 second during 10 seconds:
>>[u,t] = gensig(‘square’,4,10,0.1);
Transfer function:
2 s^2 + 5 s + 1
-----------------
s^2 + 2 s + 3
>> lsim(H,u,t)
Exercise 2:
Exercise 3:
Plot the response of the system when R(s) is a unit impulse and unit step for the
parameter z=3, 6 and 12.