Sie sind auf Seite 1von 16

Lab#6 Introduction to “lsim” and Time Response of

1st and 2nd Order Systems


Objectives

 To implement transfer function,


 introduction to LSIM command,
 To evaluate and analyze responses of first and second order systems.

Step response:
To find the step response of a system, step function can be used. The general syntax is:
>>[y, t] = step (sys)

LSIM command:
Simulate time response of LTI models to arbitrary inputs. Where sys can be transfer function or
state space representation of system, u is the input signal which is a function of time; t is the time
axis that can be defined using linspace. It contains the values of time at which output is to be
calculated. >>[y, t] = lsim (sys, u, t)
Natural response:
The impulse response of a system can be found using impulse function. The general syntax is:
>>[y, t] = impulse (sys) Where sys is transfer function. Returns the impulse response ‘y’ and
the time vector t used for simulation

POLE
computes the poles of LTI models. >>pole (sys)

STEP
computes the step response of an LTI system and returns time and magnitudes in y and t
respectively. >>[y, t] = step (sys)

IMPULSE
calculates the impulse response of the LTI model SYS (created with TF, ZPK, or SS).
>>[y, t] = impulse (sys

DAMP
For calculating natural frequency and damping of LTI model
[Wn,Z, P] = DAMP(SYS)
Lab Tasks

Lab Task No 1:
close all;
clear all;
clc;
t=0:0.01:30;
sys=tf([1],[1 1]);
y=step(sys)
plot(y)
title('for T=1');

t=0:0.01:30;
sys=tf([1],[2 1]);
y=step(sys)
plot(y)
title('for T=2');
clc;
t=0:0.01:30;
sys=tf([1],[3 1]);
y=step(sys)
plot(y)
title('for T=3');

b) Comment the effect of time constant on the speed of the system response.

Time constant affects the speed of the system response. When T is small then system will be
stable sooner enough comparative to high values of time constant.

c)

close all;
clear all;
clc;
syms s
t=0:.1:30;
u=ones(length(t),1);
sys1=tf([1],[1,1])
y1=lsim(sys1,u,t)
plot(t,y1)
title('FOR T=1')
close all;
clear all;
clc;
syms s
t=0:.1:30;
u=ones(length(t),1);
sys1=tf([1],[2,1])
y1=lsim(sys1,u,t)
plot(t,y1)
title('FOR T=2')
close all;
clear all;
clc;
syms s
t=0:.1:30;
u=ones(length(t),1);
sys1=tf([1],[3,1])
y1=lsim(sys1,u,t)
plot(t,y1)
title('FOR T=3')

Comments:
in this task we are just finding the step response of given function using values of T different
without using the lsim’ command but in second step we do find same thing using Lsim
command and result is same in both cases

TASK 2
a)
close all
clear all
clc
t=0:0.01:30;
u1=sin(t)
sys=tf([1],[1,1])
y1=lsim(sys,u1,t)
plot(t,y1)
close all
clear all
clc
t=0:0.01:30;
u=exp(-t)
sys=tf([1],[1,1])
y=lsim(sys,u,t)
plot(t,y)
b)

Comments:
In this task it was required to find out the sin and exponential responses by using MATLAB and
SIMULINK. Exp (-t) is just a impulse that is why I have used impulse block in SIMULINK.
Result using both of the techniques is same.

Task 3
For wn =10rads/sec, plot the step response for general second order system for zeta=0, 0.7, 1,
1.5, and compare the four systems.

close all
clear all
clc
sys1=tf([100],[1 0 100])
y=step(sys1)
plot(y)
title('For k=10 and zeta=0')

close all
clear all
clc
sys1=tf([100],[1 14 100])
y=step(sys1)
plot(y)
title('For k=10 and zeta=0,7')

close all
clear all
clc
sys1=tf([100],[1 20 100])
y=step(sys1)
plot(y)
title('For k=10 and zeta=1')

close all
clear all
clc
sys1=tf([100],[1 30 100])
y=step(sys1)
plot(y)
title('For k=10 and zeta=1.5')

Comments:
In this task a second order deferential equation was given to us we are required to find the step
response of that equation. Equation was generall and consists of two variables so our goal was to
find step response at different values of the given variable
Task 4
For the systems given in task 1 plot their poles and identify the effect of pole locations on the
settling time of the system.

close all
clear all
clc
sys1=tf([1],[1 1])
step(sys1)
pole(sys1)
pzmap(sys1)

close all
clear all
clc
sys=tf([1],[2 1])
step(sys)
pole(sys)
pzmap(sys)
close all
clear all
clc
sys=tf([1],[3 1])
step(sys)
pole(sys)
pzmap(sys)

Comments
In this task we are required to plot the poles of system given task 1

When poles are in the left half plane then the system is stable.
When the poles are in the right half plane then the system is unstable.
When the poles are on jw axis then the system is marginally stable.
When the poles are real and negative then we get step response.

Task 5

Plot %OS vs. damping ratio and analyze the plot carefully.
z=0:0.01:1;
wn=10;
s=(1-(z).^2);
sys1=sqrt(s);
os=100.*exp((-(z.*3.14))./sys1);
plot(z,os);
Comments:
In this task it was the need to analyze graph of duty ratio vs. percentage overshoot Percentage
overshoot can be found by P.O. = 100e −ζπ /(1−ς 2)^1/2 and damping ratio of an eigen value are Z
= -cos(angle(log(lambda))) . So just using these two formulas we draw and analyze the above
graph

Post lab
Task 1:

Find the natural response of the following first order system. Assuming v(0)=10.

Hint: The circuit equation for the circuit is RC dv/dt +v = 0


close all
clear all
clc
sys=tf([1],[1 1]);
y=impulse(sys)
plot(y)

Comments:
In this task source free circuit was given to us and we were required to plot the natural response
using both MATLAB and SIMULINK. So in both case result is same

Task 2:
close all
clear all
clc
R=1;
L=10^-3;
C=10^-6;
x=tf([1/L 0],[1 R/L 1/(L*C)])
subplot(2,1,1)
step(x)
subplot(2,1,2)
impulse(x)

Calculation:
wn =
1.0e+003 *
1.0000
1.0000

z=
1.0e-006 *
0.5000
0.5000
p=
1.0e+002 *
-0.0000 +10.0000i
-0.0000 -10.0000i
os =
99.9998
99.9998
ts =
1.0e+003 *
8.0000
8.0000
tp =
0.0031
0.0031

Comments:
This is same as previous task just here we were dealing with sourced circuit and we required
finding out impulse and stepping response using MATLAB and calculation.

Conclusion:
In this lab, we learned how to implement the transfer functions on MATLAB. We also learned
how to solve the 1st order differential equations and 2nd order differential equations on MATLAB
to find their t poles and zeros and their locations. We also used the different new commands on
MATLAB to check the different responses of different systems. We also acquired the introduction
to LSIM.
Lab: 06
Course: EEE325 Control System
Instructor: Engr. Turrab Abid
Student:
Reg. Number: FA14-EPE-029
Name: ABDUL RABI
Batch: FALL 2014
(Do not write anything here)

Group members: MEER HAMZA AHMAD


MUHAMMAD UMAIR
ASSESSMENT
Pre-lab Task: /
Lab Performance: /
Post-Lab: /
Total: /

Instructor’s remarks:

Das könnte Ihnen auch gefallen