Control Exp 4 Student Manual
Control Exp 4 Student Manual
Control Exp 4 Student Manual
Students will first learn about the different MATLAB functions for different mathematical
operations. After that they will run MATLAB programs to solve some particular problems.
They will compare the results of MATLAB and SIMULINK later.
Introduction:
MATLAB allows designers to perform complicated mathematical calculations in fast and
efficient manner. Partial fraction expansion, simplification, pole-zero determination, Laplace
transform, inverse Laplace transform, state-space model generation are some of the
mathematical operation that can be very easily performed in MATLAB. Performing Laplace
and inverse Laplace transforms are mathematical methods. They are widely used in
control systems. After performing Laplace transforms, different mathematical operations can
be applied to them. Students will learn to implement them using MATLAB.
To view the step response of a particular system for a particular transfer function, unit
step function is given as an input. The output is then the step response.
If OUTPUTS1 and INPUTS2 are omitted, SERIES connects SYS1 and SYS2 in cascade
and returns
SYS = SYS2 * SYS1
If SYS1 and SYS2 are arrays of LTI models, SERIES returns an LTI array SYS of the
same size where SYS(:,:,k) = SERIES(SYS1(:,:,k),SYS2(:,:,k),OUTPUTS1,INPUTS2) .
o PRINTSYS: Print system in pretty format and is used to print state space systems with
labels to the right and above the system matrices or to print transfer functions as a ratio of
two polynomials.
PRINTSYS(NUM,DEN,'s') or PRINTSYS(NUM,DEN,'z') prints the transfer function as a
ratio of two polynomials in the transform variable 's' or 'z'.
Negative feedback is assumed and the resulting system SYS maps u to y. To apply
positive feedback, use the syntax:
SYS = FEEDBACK(SYS1,SYS2,+1).
Vectors B and A specify the coefficients of the numerator and denominator polynomials in
descending powers of s. The residues are returned in the column vector R, the pole
locations in column vector P, and the direct terms in row vector K. The number of poles is
n = length(A)-1 = length(R) = length(P). The direct term coefficient vector is empty if
length(B) < length(A), otherwise length(K) = length(B)-length(A)+1.
o The sym command creates symbolic variables and expressions. For example, the
commands x = sym('x'); a = sym('alpha'); create a symbolic variable x with the value x
assigned to it in the MATLAB workspace and a symbolic variable ‘a’ with the value alpha
assigned to it. An alternate way to create a symbolic object is to use the syms command:
x = Ax + B
o Time limit is selected using t=[ lower limit : interval : upper limit]. For example,
t = [ 0:0.1:20]
1. Write down two transfer functions (as if after performing Laplace transform on them) that
are defined as follows:
𝑛𝑢𝑚𝑔 1 𝑛𝑢𝑚𝑐 𝑆+1
= and =
𝑑𝑒𝑛𝑔 500𝑆 2 𝑑𝑒𝑛𝑐 𝑆+2
Then use the MATLAB function “series” and apply a negative feedback. Both
expressions should be viewed using the MATLAB function “printsys”.
2. Write down the following transfer function (after performing Laplace transform on it):
5400
𝐺 (𝑆 ) =
2𝑆 2 + 2.5𝑆 + 5402
Now using the MATLAB function “step” a unit step function is given as an input for the
wheel velocity versus time response and the output response is seen for certain time limit
defined as “t”.
3. Using the MATLAB function “poly”, convert ‘deny’ to polynomial from the roots value given in
the program. Then using the MATLAB function “residue”, do partial fraction expansion to the
function defined by ‘numy’ and ‘deny’.
r=
1
-2
1
p=
-8
-4
0
k=
[]
4. Write down the following transfer function (as if after performing Laplace transform on
it) first as row vector.
150𝑆 2 + 300𝑆 + 1050
𝐺 (𝑆 ) =
𝑆 2 + 5.4𝑆
Then using the MATLAB function “tf”, show an actual mathematical expression of the
transfer function in the output.
5. Define the transfer function (as if after performing Laplace transform on it) as two
separate row vectors for numerator and denominator. Define the gain "k" as a variable.
Then using the MATLAB function “zpk”, convert the transfer function to zero pole gain
format.
20(𝑆 + 2)(𝑆 + 4)
𝐺 (𝑆 ) =
(𝑆 + 7)(𝑆 + 8)(𝑆 + 9)
6. Define a symbolic variable 's' and then define Laplace transformed functions 'F1' and
‘F2’ using 's' for the following equations. After that, apply inverse Laplace transform to
'F1' and ‘F2’ using the MATLAB function “ilaplace”. Show all the equations in standard
mathematical format using the MATLAB function “pretty”.
2 3
i) 𝐹1 = (𝑆+1)(𝑆+2)2
and ii) 𝐹2 = 𝑆 (𝑆 2+2𝑆+5)
7. Define symbolic variable 't' and then define an inverse Laplace transform function 'f'.
After that, apply Laplace transform to 'f' using the MATLAB function “laplace”. Show
all the equations in standard mathematical format using the MATLAB function “pretty”
and do further simplification using the MATLAB function "simplify".
8. Define a transfer function (as if after performing Laplace transform on it) as two separate
row vectors for numerator and denominator. Then convert the transfer function to its
equivalent state space representation using the MATLAB function “tf2ss”.
© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 5
Program segment 8 output in the MATLAB command window:
a=
x1 x2 x3
x1 -8.00000 -18.00000 -6.00000
x2 1.00000 0 0
x3 0 1.00000 0
b=
u1
x1 1.00000
x2 0
x3 0
c=
x1 x2 x3
y1 2.00000 8.00000 6.00000
d=
u1
y1 0
9. From exercise # 8, several state space representation variables are defined. Convert them
to transfer function using mathematical equation.
10. Perform step responses of the second order system for different values of zeta (ζ). (The
same problem will be done with SIMULINK later).
ω2n
G (S) =
S 2 + 2ζωn S + ω2n
1.8
1.6
1.4
1.2
wheel velocity
0.8
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5 3
time [ s ec]
1.8
1.6
1.4
1.2
1
y(t)
0.8
0.6
0.4
0.2
0
0 2 4 6 8 10 12 14 16 18 20
W nt
Apparatus:
1) Computer
2) MATLAB Software Installed in the
Computer
Precautions:
Students should take the following precautions while conducting the experiment -
1. Check the PC if it is working; otherwise inform lab instructor,
2. Be careful while handling the power supply buttons of computers and to keep
them off when they are not needed,
3. Check if MATLAB is working correctly and beware of typing mistakes.
Experimental Procedure:
1. Run the MATLAB code and identify the outputs.
2. Step responses should be checked and compared by zooming over the overshoot portion
and the time it takes to reach the steady state value.
Reference(s):
Norman S. Nise, “Control Systems Engineering”, available Edition, John Wiley & Sons Inc.