An Introduction to MATLAB
Tools:
1) IBM PC
2) Mat lab 7 Version
Description:
What is MATLAB
det(A)
MATLAB commands can be entered one line at a time, or the user can write programs
of MATLAB code and define his or her own functions. In this session, we shall only
use the onelineatatime “interpretive” mode for simplicity, but the regular user will
find that the power of the package is considerably extended by writing his or her own
programs and functions.
To enter MATLAB, simply double click on the MATLAB icon. To leave MATLAB
and return to the PC’s operating system
Simply type: quit
Aisha Muslim:
BS (TE)04407F
v = [2 4 7 5];
w = [1 3 8 9];
(a) v(2)
ans =
(b) sum = v + w
sum =
3 7 15 14
(c) diff = w  v
diff =
1 1 1 4
(d) vw = [v w]
vw =
2 4 7 5 1 3 8 9
(e) vw(2:6)
ans =
4 7 5 1 3
(f) v'
ans =
2
4
7
5
BS (TE)04407F
Now the matlab window shows all these commands excuted in command window
1
1
z=
0
0
v = [2 4 7 5];
(i) z' (b) z*v (c) [v; w] (d) v*z (e) [z; v’] (f) z + v’
(i) z'
ans =
1 1 0 0
(b) z*v
ans =
BS (TE)04407F
2 4 7 5
2 4 7 5
0 0 0 0
0 0 0 0
(c) [v; w]
ans =
2 4 7 5
1 3 8 9
(d) v*z
ans =
Now the matlab window shows all these commands excuted in command window
BS (TE)04407F
ans =
1
1
0
0
2
4
7
5
(f) z + v'
ans =
3
5
7
5
Now the matlab window shows all these commands window executed in command
window;
BS (TE)04407F
1 2
M=
3 4
(a) N = inv(M) (b) M*N (c) I = eye(2) (d) M + I (e) M*z(1:2) (f) v(3:4)*M
(g) M(1,1) (h) M(1:2,1:2) (i) M(:,1) (j) M(2,:)
(a) N = inv(M)
N=
2.0000 1.0000
1.5000 0.5000
(b) M*N
ans =
BS (TE)04407F
1.0000 0
0.0000 1.0000
(c) I = eye(2)
I=
1 0
0 1
(d) M + I
ans =
2 2
3 5
Now the matlab window shows all these commands excuted in command window
BS (TE)04407F
(e) M*z(1:2)
ans =
3
7
(f) v(3:4)*M
ans =
22 34
(g) M(1,1)
ans =
BS (TE)04407F
(h) M(1:2,1:2)
ans =
1 2
3 4
(i) M(:,1)
ans =
1
3
(j) M(2,:)
ans =
3 4
Now the matlab window shows all these commands excuted in command window
BS (TE)04407F
Exercise#4: Use the help command to find out about the following builtin functions
and make up your own simple examples:
1. ones 2. zeros 3. det 4. Linspace 5. Logspace
1. ones
2. zeros
3. det
DET Determinant.
DET(X) is the determinant of the square matrix X.
4. Linspace
5. Logspace
t=linspace(0,20,100);
Exercise#5:
1. Generate a vector yc containing the values of cos(t) for the time range given
above.
The program code is
BS (TE)04407F
ys = sin(t);
BS (TE)04407F
2. From the “help” entry for “plot” find out how to get both ys and yc plotted against t
on the same axis.
3. From the “help” entry for “subplot” find out how to plot ys and yc plotted on two
separate graphs, one above the other.
SUBPLOT(2,1,1), PLOT(income)
SUBPLOT(2,1,2), PLOT(outgo)
BS (TE)04407F
Exercise#1:
100
G(S) == 2
S +14S+100
Solution:
(c) Use the plot function to plot the poles of the above transfer function marked by
the symbol ‘x’. Record this plot in your lab book with your Roll. No on the top
of the plot.
BS (TE)04407F
Exercise#2:
(a) What is the difference between the builtin function “conv” and “series”?
Answer:
Conv: this function first computes the numerator and denominator of the
resultant transfer function separately by multiplying the respective entity.
Series: this is the built in function in mat lab to compute the transfer function of
two functions attached in series by accepting the four parameters of the num and
denominator of series functions.
(b) Reduce each of the following block diagrams into a single block form. In each
case find poles and zeros and sketch pole zero diagram. In which block diagrams
you cannot use the function “series”? Why? Also determine whether the system is
stable or not?
(i)
5(3S+27)
99
9S + 27 7(S3+12S2+9S+27
In these diagrams we can use the series function because there are only two blocks connected
in series. So the code for single block is
num1 = 99;
den1 = [9 27];
num2 = 5*[3 27];
den2 = 7* [1 12 9 27];
[num12, den12] = series (num1, den1, num2, den2);
printsys (num12, den12)
num/den =
1485 s + 13365

63 s^4 + 945 s^3 + 2835 s^2 + 3402 s + 5103
BS (TE)04407F
poles=roots(den12)
poles =
11.4189
3.0000
0.2905 + 1.5100i
0.2905  1.5100i
zeros=roots(num12)
zeros =
9
pzmap(poles,zeros)
BS (TE)04407F
The system is stable because all poles lie on the left half plane.
2S + 4 4/5 S2
(ii)
S3 S+3 S6
In these diagrams we can not use the series function because there are three blocks connected in
series. So the code for single block is
num1 = [2 4];
den1 = [1 0 0 0];
num2 = 4/5;
den2 = [1 3];
num3=[1 0 0];
den3=[1 6];
num12 =conv(num1,num2);
den12 = conv(den1,den2);
BS (TE)04407F
num123 =conv(num12,num3);
den123 = conv(den12,den3);
printsys (num123, den123)
num/den =
poles=roots(den123)
poles =
0
0
0
6.0000
3.0000
zeros=roots(num123)
zeros =
0
0
2
BS (TE)04407F
pzmap(poles,zeros)
BS (TE)04407F
The system is unstable because pole of the function lie on the right half plane at s=6
as well as on the right half plane.
(iii)
2 S+6
S 9S 22
2
S+3 S +S+1 S+8 S + 5.6
In these diagrams we can not use the series function because there are three
blocks connected in series. So the code for single block is
num1 = [1 0 0];
den1 = [1 3];
num2 = [1 6];
den2 = [1 1 1];
num3=[9 0];
den3=[1 8];
num4=22;
den4=[1 5.6];
BS (TE)04407F
num12 =conv(num1,num2);
den12 = conv(den1,den2);
num123 =conv(num12,num3);
den123 = conv(den123,den3);
num1234 =conv(num123,num4);
den1234 = conv(den123,den4);
printsys (num1234, den1234)
num/den =
poles=roots(den1234)
poles =
0
0
0
6.0000
8.0000
5.6000
3.0000
zeros=roots(num1234)
zeros =
0
0
0
6
BS (TE)04407F
pzmap(poles,zeros)
BS (TE)04407F
Exercise#3
(a) Consider the following block diagram. Find the closed loop transfer function.
9
R(S) S+5 C(S)

Solution:
num1 = 9;
den1 = [1 5];
num2 = 1;
den2 = 1;
[n,d]=feedback(num1,den1,num2,den2);
printsys(n,d)
num/den =
9
BS (TE)04407F

s + 14
(b) Find the closed loop transfer function of the following block diagram.
S+2
R(S) 2
S +3S +12 C(S)
+
Solution:
num1 = [1 2];
den1 = [1 3 12];
num2 = 1;
den2 = 1;
[n,d]=feedback (num1, den1, num2,den2,+1);
printsys(n,d)
num/den =
s+2

s^2 + 2 s + 10
(c) Find the closed loop transfer function of the following block diagram.
1
R(S) S +1 C(S)

2
S
Solution:
BS (TE)04407F
num1 = 1;
den1 = [1 1];
num2 = 2;
den2 = [1 0];
[n,d]=feedback(num1,den1,num2,den2);
printsys(n,d)
num/den =
s

s^2 + s + 2
(d) Find the closed loop transfer function of the following block diagram.
S
R(S) S +6 C(S)

num1 = [1 0];
den1 = [1 6];
num2 = [2 1]; 2S+1
den2 = [1 2]; S+2
[n,d]=feedback(num1,den1,num2,den2);
printsys(n,d)
num/den =
s^2 + 2 s

3 s^2 + 9 s + 12
The mat lab command window executing the above commands is shown as
following;
BS (TE)04407F
Lab Practical # 03
Introduction to Simulink
Introduction
Simulink is a software package for modeling, simulating, and analyzing dynamic
systems. It supports linear and nonlinear systems, modeled in continuous time,
sampled time, or a hybrid of the two. One can easily build, analyze and visualize
models.
Thousands of engineers around the world using it to model and solve real problems.
Simulink provides a graphical user interface (GUI) for building models as block
diagrams, using clickanddrag mouse operations. With this interface, you can draw
BS (TE)04407F
the models just as you would with pencil and paper. Knowledge of this tool will serve
you well throughout your professional career.
G(S) = 1
S+1
Solution:
First in the untitled page of mat lab simulinks we created this model by copying the
blocks into the model from the respective Simulink block libraries:
BS (TE)04407F
The result of above after choosing the Start from the Simulation menu
and watch the simulation output on the Scope.
BS (TE)04407F
(c) Differentiate the ramp function and check the result on the scope.
Solution:
First in the untitled page of mat lab simulinks, we created this model by copying the
blocks into the model from the respective Simulink block libraries:
BS (TE)04407F
BS (TE)04407F
The result of above after choosing the Start from the Simulation menu
and watch the simulation output on the Scope.
BS (TE)04407F
After double clicking the gain block we get its properties block and setting the
gain from 1 to 2 first we get the amplified sine wave with the amplitude 2 even the
amplitude of the sine wave in the properties block is still 1 .
BS (TE)04407F
Now the result on the scope is shown below after clicking the start from the
simulation menu.
BS (TE)04407F
(e) Simulate the JK flipflop in toggle mode and copy resultant waveform in your
answer book.
SOLUTION:
BS (TE)04407F
(e) Explain briefly the function of each block you have used.
(f) Also explain in which library or sublibrary this block is present?
1. Step block:
Generate a step function
Library
Sources
Description:
The Step block provides a step between two definable levels at a specified time. If the
simulation time is less than the Step time parameter value, the block's output is the
Initial value parameter value. For simulation time greater than or equal to the Step
time, the output is the Final value parameter value.
2. Transfer Fcn:
It Implements a linear transfer function
Library:
Continuous
Description:
The Transfer Fcn block implements a transfer function where the input (u) and output
(y) can be expressed in transfer function form.
A Transfer Fcn block takes a scalar input. If the numerator of the block's transfer
function is a vector, the block's output is also scalar. However, if the numerator is a
matrix, the transfer function expands the input into an output vector equal in width to
the number of rows in the numerator. For example, a tworow numerator results in a
block with scalar input and vector output. The width of the output vector is two.
3. Scope:
Display signals generated during a simulation
Library
Sinks
Description:
The Scope block displays its input with respect to simulation time. The Scope
block can have multiple axes (one per port); all axes have a common time range
with independent yaxes. The Scope allows to adjust the amount of time and the
range of input values displayed. We can move and resize the Scope window and
you can modify the Scope's parameter values during the simulation. When we
start a simulation, Simulink does not open Scope windows, although it does
write data to connected Scopes. As a result, if we open a Scope after a
simulation, the Scope's input signal or signals will be displayed. If the signal is
BS (TE)04407F
4. Gain :
Multiply the input by a constant
Library
Math Operations
Description :
The Gain block multiplies the input by a constant value (gain). The input and
the gain can each be a scalar, vector, or matrix. You specify the value of the
gain in the Gain parameter. The Multiplication parameter lets you specify
elementwise or matrix multiplication. For matrix multiplication, this parameter
also lets you indicate the order of the multiplicands. The gain is converted from
doubles to the data specified in the block mask offline using roundtonearest
and saturation. The input and gain are then multiplied, and the result is
converted to the output data type using the specified rounding and overflow
modes.
5. Sine Wave:
Generate a sine wave
Library:
Sources
Description:
The Sine Wave block provides a sinusoid. The block can operate in either time
based or samplebased mode.
TimeBased Mode:
The output of the Sine Wave block is determined by Timebased mode has two
submodes: continuous mode or discrete mode. The value of the Sample time
parameter determines whether the block operates in continuous mode or discrete
mode: 0 (the default) causes the block to operate in continuous mode. >0 causes
the block to operate in discrete mode.
SampleBased Mode:
Samplebased mode uses the following formula to compute the output of the
Sine Wave block.
Y = a sin(2*pi*(k+0)/p+b)
where
A is the amplitude of the sine wave.
p is the number of time samples per sine wave period.
k is a repeating integer value that ranges from 0 to p1.
o is the offset (phase shift) of the signal.
Control systems lab manual
Aisha Muslim:
BS (TE)04407F
BS (TE)04407F
Lab Practical # 04
State Space Representation
1. Introduction:
A Control system can be represented as:
d/dx = Ax + BU
d/dx = Cx + DU
Where A, B, C and D are matrices, x is the state vector, y is the output vector and u is
the input vector. The above representation can be obtained from the differential
equation or transfer function of the system under considerations.
MATLAB has builtin functions tf2ss (transfer function to state space) and ss2tf (state
space to transfer function) to convert transfer function model into state space
representation and vice versa. Following examples demonstrate the use of both of
these functions.
Exercise#1:  Find the state space representation of the following transfer functions.
S+2
1).
G(S) =
S 2+ 7S + 12
Solution:
num= [1 2];
den= [1 7 12];
[A, B, C, D]=tf2ss (num, den);
printsys (A, B, C, D)
BS (TE)04407F
After executing the above code in command window of mat lab we get the
following result
a=
x1 x2
x1 7.00000 12.00000
x2 1.00000 0
b=
u1
x1 1.00000
x2 0
c=
x1 x2
y1 1.00000 2.00000
d=
u1
y1 0
(S+1)(S +2)
2). G(S) =
S(S 2+3S+1)
Solution: =
num= [1 3 2];
den= [1 3 1 0];
[A, B, C, D]=tf2ss (num, den);
printsys (A, B, C, D)
After executing the above code in command window of mat lab we get the
following result
a=
x1 x2 x3
x1 3.00000 1.00000 0
x2 1.00000 0 0
x3 0 1.00000 0
BS (TE)04407F
b=
u1
x1 1.00000
x2 0
x3 0
c=
x1 x2 x3
y1 1.00000 3.00000 2.00000
d=
u1
y1 0
Now the mat lab window shows the results of above questions:
BS (TE)04407F
Exercise#2:
(a).
Solution:
After executing the above code in command window of mat lab we get the
following result
num/den =
4.2188e015 s^2 + 9 s  3

S^3  7 s  6
BS (TE)04407F
2).
Solution:
A= [0 1 0; 0 0 1;6 11 6];
B= [0; 0; 0];
C= [1 0 0];
D=0;
[num, den]=ss2tf (A, B, C, D);
printsys (num, den)
After executing the above code in command window of mat lab we get the
following result
num/den =
4.2188e015 s^2 + 9 s  3

S^3  7 s  6
Eigen values
Exercise#3:
Find the Eigen values of the systems with
0 2 0 0 0
0.1 0.35 0.1 0.1 0.75
0 0 0 2 0
A= 0.4 0.4 0.4 0.4 0
0 0.03 0 0 1
A= [0 2 0 0 0;0.1 0.35 0.1 0.1 0.75;0 0 0 2 0;0.4 0.4 0.4 0.4 0;0 0.03 0 0 1];
B=eig (A)
After executing the above commands in mat lab command window we get;
B=
0.8061
Control systems lab manual
Aisha Muslim:
BS (TE)04407F
0.2223 + 0.9426i
0.2223  0.9426i
0.4321
0.9794
Now the mat lab window showing the above commands is given below;
b)... compute the eign values of the system given in exercise 2(a) and 2(b).
1).
Solution:
B=
BS (TE)04407F
1
2
3
2).
Solution:
A= [0 1 0; 0 0 1;6 11 6];
B=eig (A)
After execution we get
B=
1.0000
2.0000
3.0000
Exercise#4:
BS (TE)04407F
Solution:
t=4;
A= [1 0 0; 0 2 3; 0 0 3];
B=expm (A*t)
After execution of the above code we have
B=
1.0e+005 *
0.0000 0 0
0 0.0000 0.9765
0 0 1.6275
Solution:
t=0;
A= [0 1 0; 0 0 1;6 11 6];
B=expm (A*t)
After execution of the above code we have
B=
1 0 0
0 1 0
0 0 1
BS (TE)04407F
Now the mat lab window shows the above all programs;
BS (TE)04407F
Lab Practical # 05
Time Response of a Control System
1. Introduction
Exercise#1:  Find transient and steady state characteristics of the following transfer
functions.
a).
num = [1 2];
den = [1 7 12];
step(num,den)
grid on
BS (TE)04407F
b).
num = [1 3 2];
den = [1 3 1 0];
step(num,den)
grid on
BS (TE)04407F
Exercise#2:  Reduce the following open loop systems into a single block and find
time response of the system.
(i)
9(S+3)
S
2S2 + 9s +
9S + 17
27
Solution:
num1= [1 0];
den1= [9 17];
num2= [9 27];
den2= [2 9 27];
[num12, den12]=series (num1, den1, num2, den2);
printsys(num12, den12)
After executing the above code we get the single transfer function as
BS (TE)04407F
num/den =
9 s^2 + 27 s

18 s^3 + 115 s^2 + 396 s + 459
>>
Now for the transient and steady state response in terms of step input is
(ii)
2S + 4 4/5 S2
S3 S+3 S6
num1 = [2 4];
BS (TE)04407F
den1 = [1 0 0 0];
num2 = 4/5;
den2 = [1 3];
num3=[1 0 0];
den3=[1 6];
num12 =conv(num1,num2);
den12 = conv(den1,den2);
num123 =conv(num12,num3);
den123 = conv(den12,den3);
printsys (num123, den123)
After executing the above code we get the single transfer function as
num/den =
BS (TE)04407F
(i)
9
R(S) S+5 C(S)

Solution:
num1 = 9;
den1 = [1 5];
num2 = 1;
den2 = 1;
[n,d]=feedback (num1, den1, num2, den2);
BS (TE)04407F
printsys(n,d)
For the equilent transfer function of the feedback system we get the following result
from mat lab command window;
num/den =
9

s + 14
Now for the transient and steady state response in terms of step input is
step(n,d)
BS (TE)04407F
(ii)
1
R(S) S +1 C(S)

2
S
Solution:
num1 = 1;
den1 = [1 1];
num2 = 2;
den2 = [1 0];
[n,d]=feedback(num1,den1,num2,den2);
printsys(n,d)
For the equilent transfer function of the feedback system we get the following result
from mat lab command window;
num/den =
s

s^2 + s + 2
Now for the transient and steady state response in terms of step input is
step(n,d)
BS (TE)04407F
BS (TE)04407F
Lab Practical # 06
Time domain analysis of Second Order System
Introduction
Where ωn is the natural undamped frequency and ς is damping ratio. Thus the
response of the second order system depends upon both factors. In this lab we will
analyze the effect of variation of damping ratio and natural undamped frequency on
the response of the system.
Exercise#1: 
After putting ς = 0.2 and ωn = 0.1 rad/sec we get the transfer function
BS (TE)04407F
0.01
G(S) = 2
S +0.04S+0.01
By entering the following MATLAB code we can find the step response of the system
num = 0.01
den = [1 0.04 0.01];
step (num, den)
grid on
The command window shows the value of the numerator as
num =
0.0100
BS (TE)04407F
After putting ς = 0.5 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.01S+0.01
By entering the following MATLAB code we can find the step response of the system
num = 0.01
den = [1 0.01 0.01];
step (num, den)
grid on
The command window shows the value of the numerator as
num =
0.0100
BS (TE)04407F
After putting ς = 0.81 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.162S+0.01
By entering the following MATLAB code we can find the step response of the system
num = 0.01
den = [1 0.162 0.01];
step (num, den)
grid on
The command window shows the value of the numerator as
num =
0.0100
BS (TE)04407F
After putting ς = 2.5 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.5S+0.01
By entering the following MATLAB code we can find the step response of the system
num = 0.01
den = [1 0.5 0.01];
step (num, den)
grid on
The command window shows the value of the numerator as
num =
0.0100
BS (TE)04407F
Answer:
The effect of increasing the value of damping ratio ς. in part (1) of the question is
that the system’s transient response is more stable and more time the system will
take to reach the steady state.
Exercise#2: 
After putting ς = 0.2 and ωn = 0.1 rad/sec we get the transfer function
BS (TE)04407F
0.01
G(S) = 2
S +0.04S+0.01
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.01
den = [1 0.04 0.01];
impulse(num,den)
grid on
num =
0.0100
After putting ς = 0.5 and ωn = 0.1 rad/sec we get the transfer function
BS (TE)04407F
0.01
G(S) = 2
S +0.01S+0.01
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.01
den = [1 0.01 0.01];
impulse(num,den)
grid on
num =
0.0100
BS (TE)04407F
After putting ς = 0.81 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.162S+0.01
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.01
den = [1 0.162 0.01];
impulse(num,den)
grid on
num =
0.0100
BS (TE)04407F
After putting ς = 2.5 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.5S+0.01
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.01
den = [1 0.5 0.01];
impulse(num,den)
grid on
num =
0.0100
BS (TE)04407F
Exercise#3: 
BS (TE)04407F
After putting ς = 0.2 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.04S+0.01
By using the following MATLAB code we can find the ramp response of the system
t=0:0.01:10;
r=t;
num = 0.01
den = [1 0.04 0.01];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
num =
0.0100
BS (TE)04407F
After putting ς = 0.5 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) =
S 2+0.01S+0.01
By using the following MATLAB code we can find the ramp response of the system
t=0:0.01:10;
r=t;
num = 0.01
den = [1 0.01 0.01];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
BS (TE)04407F
num =
0.0100
After putting ς = 0.81 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.162S+0.01
BS (TE)04407F
By using the following MATLAB code we can find the ramp response of the system
t=0:0.01:10;
r=t;
num = 0.01
den = [1 0.162 0.01];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
num =
0.0100
BS (TE)04407F
After putting ς = 2.5 and ωn = 0.1 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.5S+0.01
By using the following MATLAB code we can find the ramp response of the system
t=0:0.01:10;
r=t;
num = 0.01
den = [1 0.5 0.01];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
num =
0.0100
BS (TE)04407F
(f) What is the effect on steady state error with the increasing the value of ς.
Answer:
The slope of the transient response of the system is more steepest after increasing
the value of ς.
Exercise#4: 
(a) Find step, ramp and impulse response of the system when
ωn = 0.1, 0.2, 0.5 and 1 rad/sec
ς = 0.2 ωn2
G(S) =
S2 + 2ςωnS +ωn2
Step responses:
After putting ωn = 0.1 and ς = 0.2 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.04S+0.01
BS (TE)04407F
By entering the following MATLAB code we can find the step response of the system
num = 0.01
den = [1 0.04 0.01];
step (num, den)
grid on
num =
0.0100
BS (TE)04407F
After putting ωn = 0.2 and ς = 0.2 rad/sec we get the transfer function
0.04
G(S) = 2
S +0.08S+0.04
By entering the following MATLAB code we can find the step response of the system
num = 0.04
den = [1 0.08 0.04];
step (num, den)
grid on
num =
BS (TE)04407F
0.0400
After putting ωn = 0.5 and ς = 0.2 rad/sec we get the transfer function
0.25
G(S) = 2
S +0.2S+0.25
By entering the following MATLAB code we can find the step response of the system
num = 0.25
den = [1 0.2 0.25];
step (num, den)
grid on
BS (TE)04407F
num =
0.2500
1
G(S) = 2
S +0.4S+1
BS (TE)04407F
By entering the following MATLAB code we can find the step response of the system
num = 1;
den = [1 0.4 1];
step (num, den)
grid on
num =
1.0000
BS (TE)04407F
Impulse responses:
After putting ωn = 0.1 and ς = 0.2 rad/sec we get the transfer function
0.01
G(S) = 2
S +0.04S+0.01
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.01
den = [1 0.04 0.01];
impulse (num, den)
grid on
The command window shows the value of the numerator as
num =
0.0100
The impulse response figure is given below
BS (TE)04407F
After putting ωn = 0.2 and ς = 0.2 rad/sec we get the transfer function
0.04
G(S) = 2
S +0.08S+0.04
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.04
den = [1 0.08 0.04];
impulse (num, den)
grid on
num =
BS (TE)04407F
0.0400
The impulse response figure is given below
After putting ωn = 0.5 and ς = 0.2 rad/sec we get the transfer function
0.25
G(S) = 2
S +0.2S+0.25
By entering the following MATLAB code we can find the impulse response of the
system
num = 0.25
den = [1 0.2 0.25];
impulse (num, den)
grid on
BS (TE)04407F
num =
0.2500
1
G(S) = 2
S +0.4S+1
By entering the following MATLAB code we can find the impulse response of the
system
num = 1;
den = [1 0.4 1];
impulse (num, den)
grid on
BS (TE)04407F
num =
1.0000
Ramp responses:
After putting ωn = 0.1 and ς = 0.2 rad/sec we get the transfer function
0.01
G(S) =
S 2+0.04S+0.01
By entering the following MATLAB code we can find the ramp response of the
system
t=0:0.01:10;
r=t;
BS (TE)04407F
num = 0.01
den = [1 0.04 0.01];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
num =
0.0100
The ramp response figure is given below:
After putting ωn = 0.2 and ς = 0.2 rad/sec we get the transfer function
0.04
G(S) = 2
S +0.08S+0.04
BS (TE)04407F
By entering the following MATLAB code we can find the ramp response of the
system
t=0:0.01:10;
r=t;
num = 0.04
den = [1 0.08 0.04];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
num =
0.0400
The ramp response figure is given below:
BS (TE)04407F
After putting ωn = 0.5 and ς = 0.2 rad/sec we get the transfer function
0.25
G(S) = 2
S +0.2S+0.25
By entering the following MATLAB code we can find the ramp response of the
system
t=0:0.01:10;
r=t;
num = 0.25;
den = [1 0.02 0.25];
plot(r,t)
hold on
lsim(num,den,r,t)
hold off
grid on
BS (TE)04407F
num =
0.2500
The ramp response figure is given below:
By entering the following MATLAB code we can find the ramp response of the
system
t=0:0.01:10;
r=t;
num = 1;
den = [1 0.4 1];
plot(r,t)
hold on
BS (TE)04407F
lsim(num,den,r,t)
hold off
grid on
num =
1.0000
The ramp response figure is given below:
BS (TE)04407F