LAB1
LAB1
SUBJECT:
CONTROL SYSTEM
Group Members:
Muhammad Ammar Adil (FA20-EPE-056)
IHSAN KHAN (FA30-EPE-112)
Submitted to:
Mam Zainab
A P C
TOTAL MARKS
OBTAINED MARKS
1
CONTROL SYSTEM LABORATORY REPORT 1
Example#1
t = 0:0.01:10;
u = sin(t);
y=lsim(sys,u,t);% Sinusoidal response
plot(t,y)
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
title('Sine Response for system G(s)=1/(s+1)','fontweight','bold','fontsize',10)
legend('Step Response',1)
grid on;
2
CONTROL SYSTEM LABORATORY REPORT 1
Figures:
Step Response for system G(s)=1/(s+1)
1
Step Response
0.9
0.8
0.7
Amplitude
0.6
0.5
0.4
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9
Time (seconds)
0.4
Amplitude
0.2
-0.2
-0.4
-0.6
-0.8
0 1 2 3 4 5 6 7 8 9 10
Time
3
CONTROL SYSTEM LABORATORY REPORT 1
Simulink:
Output
4
CONTROL SYSTEM LABORATORY REPORT 1
Tasks:
Statement of the Problem:
Following are the two transfer functions. Plot the step and impulse response and
label properly in script as well as in Simulink. 1. (s+1)/(s2+2s+1)
2. 10/(s+1)(s+3)(s+5).
Task:
Following are the two transfer functions. Plot the step and impulse response and
label properly in script as well as in Simulink. 1. (s+1)/(s2+2s+1)
MATLAB code:
clc
Num = [1 1];
Dnum = [1 2 1];
SYS =
tf(Num
Dnum);
impulse(
SYS);
grid on
xlabel('Time','fontweight','bold','fo
ntsize',9)
ylabel('Amplitude','fontweight','bo
ld','fontsize',9) title('Impulse
Response for system
G(s)=s+1/(s^2+2s+1)','fontweight','bold','fontsize',10)
step(SYS);
grid on
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
Output
5
CONTROL SYSTEM LABORATORY REPORT 1
By using Simulink
Simulink Model of Step Response
Output:
6
CONTROL SYSTEM LABORATORY REPORT 1
Task2
Following are the two transfer functions. Plot the step and impulse response and
label properly in script as well as in Simulink.2. 10/(s+1)(s+3)(s+5).
MATLAB Code
clc
SYS = zpk([],[-1 -3 -5],41);
impulse(SYS);
grid on
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
Figure
step(SYS);
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
Output:
7
CONTROL SYSTEM LABORATORY REPORT 1
Output:
Simulink model
Conclusion
These tasks explains that how to plot the impulse response and step response in
MATLAB code and in Simulink .
8
CONTROL SYSTEM LABORATORY REPORT 1