0% found this document useful (0 votes)
31 views15 pages

EEE-404 - Control System I Lab - 2019-2020

Uploaded by

Tanvir Ahamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views15 pages

EEE-404 - Control System I Lab - 2019-2020

Uploaded by

Tanvir Ahamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Experiment 1: Determine the time response of the given system subjected to any arbitrary input

𝑪(𝒔) 𝟏
Let us consider general transfer function of first order system: 𝑻(𝒔) = 𝑹(𝒔) = 𝒔+𝟏

MATLAB CODE:
clc;
clear all;
close all;
n=[1];
d=[1,1];
%unit step response%
step(n,d)
grid on
%unit impulse response%
figure
impulse(n,d)
grid on
printsys(n,d)
%unit ramp response%
t=0:0.01:10;
r=t;
figure
lsim(n,d,r,t)
grid on;

Output: The output will be a plot of step response, impulse response, and ramp response.
Experiment 2: Plot unit step response of given transfer function and finds delay time, rise time,
peak time and peak overshoot
The transfer function of a 2nd order system is generally represented by the following transfer
𝒀(𝒔) 𝝎𝟐
function: 𝑹(𝒔) = 𝒔𝟐+𝟐𝜻𝝎𝒏 𝒔+𝝎𝟐
𝒏 𝒏

MATLAB CODE:
clc;
close all;
clear all;
zeta=0:0.25:1; % Different values of zeta is taken
for i=1:5
num=1;
den=[1 2*zeta(i) 1];
a=tf(num,den);
step(a);
hold on;
end
axis([-1 50 -0.5 2]);
grid on;
xlabel('Time');
ylabel('Response');

Output: The output will be a plot of step response for different values of zeta.

Experiment 3: Plot the pole-zero configurations in s-plane for the given transfer function
𝟐𝒔𝟐 +𝟓𝒔+𝟏
The transfer function: 𝑯(𝒔) = 𝒔𝟐 +𝟑𝒔+𝟓

MATLAB CODE:
Program to plot pole zero configuration of transfer function

clc;
clear all;
close all;
n= [2 5 1];
d=[1 3 5];
sys=tf(n,d)
pzmap(sys)

Output: The output will be a plot of poles and zeros in the complex plane.

For this particular transfer function the output will be as follow:


Experiment 4: Plot the Root locus of given transfer function, locate closed loop poles for different
values of k.

𝒔+𝟏
The transfer function: 𝑯(𝒔) = 𝒔(𝟎.𝟓𝒔+𝟏)

MATLAB CODE:
%Program to plot root locus for H(s)
clc;
clear all;
close all;
num = [1 1];
den = conv([1 0], [0.5 1]);
g = tf(num,den);
rlocus(g)

Output:
𝟏
Another transfer function: 𝑯(𝒔) = 𝒔(𝒔+𝟏)(𝒔+𝟐)

MATLAB CODE:
%Program to plot root locus for H(s) %
clc;
clear all;
close all;
num = [1];
den = poly([0 -1 -2]);
g = tf(num,den);
rlocus(g)

Output:
Experiment 5: Determine the steady state errors of a given transfer function.
10
Transfer function: 𝐻(𝑠) =
𝑠2 +6𝑠+10)

MATLAB CODE:
clc;
close all;
clear all;
n=[10];
d=[1 6 10];
sys=tf(n,d);
kp=dcgain(sys)
ess=1/(1+kp)
n1=conv([1 0],n);
sys1=tf(n1,d);
kv=dcgain(sys1)
ess=1/kv
n2=conv([1 0 0],n);
sys2=tf(n2,d);
ka=dcgain(sys2)
ess=1/ka

Output:
kp = 1
ess= 0.5
kv = 0
ess= inf
ka = 0
ess= inf
Experiment 6: Simulation of open loop, proportional, proportional derivative, proportional
integral, and proportional integral derivative controller.
𝑋(𝑠) 1
Open-loop transfer function: 𝐹(𝑠) = 𝑚𝑠2 +𝑏𝑠+𝑘)

Assumptions
Let: m = 1 [kg], b = 10 [Ns/m], k = 20 [N/m]

MATLAB CODE:
%{Set up v a r i a b l e s%
m=1; b=10; k=20;
% Calculate response%
num=1;
den=[m, b , k ];
plant=tf (num, den );
step (plant)

Output:
𝑋(𝑠) 𝐾𝑝
Proportional Controller transfer function: 𝐹(𝑠)
= 𝑠2 +𝑏𝑠+(𝑘+𝐾
𝑝)

MATLAB CODE:
%Set up proportional gain%
Kp=300;
%Calculate controller%
sys_ctl=feedback (Kp∗plant , 1);
%Plot results%
t=0:0.01:2;
step (sys_ctl, t)

Output:
𝑋(𝑠) 𝐾𝑑 𝑠+𝐾𝑝
Proportional Derivative Controller transfer function: 𝐹(𝑠) = 𝑠2 +(𝑏+𝐾
𝑑 )𝑠+(𝑘+𝐾𝑝 )

MATLAB CODE:
%Set up proportional and derivative gain%
Kp=300; Kd=10;
%Calculate controller%
contr=tf([Kd, Kp], 1);
sys_ctl=feedback(contr∗plant, 1);
%Plot results%
t=0:0.01:2;
step (sys_ctl, t)

Output:
𝑋(𝑠) 𝐾𝑝 𝑠+𝐾𝑖
Proportional Integral Controller transfer function: 𝐹(𝑠)
= 𝑠3 +𝑏𝑠2 +(𝑘+𝐾
𝑝 )𝑠+𝐾𝑖

MATLAB CODE:
%Set up Proportional Integral gain%
Kp=30; Ki =70;
%Calculate controller%
contr=tf([Kp,Ki], [1,0]);
sys_ctl=feedback(contr∗plant, 1);
% Plot results%
t=0:0.01:2;
step(sys_ctl, t)

Output:
𝑋(𝑠) 𝐾𝑑 𝑠2 +𝐾𝑝 𝑠+𝐾𝑖
Proportional Integral Derivative Controller transfer function: 𝐹(𝑠) = 𝑠3 +(𝑏+𝐾 2 +(𝑘+𝐾 )𝑠+𝐾
𝑑 )𝑠 𝑝 𝑖

MATLAB CODE:
%Set up Proportional Integral Derivative Controller gain%
Kp=350; Ki =300; Kd=50;
%Calculate controller%
contr=tf([Kd,Kp,Ki], [1, 0]);
sys_ctl=feedback(contr∗plant, 1);
%Plot results%
t=0:0.01:2;
step( sys_ctl, t)

Output:
𝑲
Plot the Root locus for transfer function 𝑮(𝒔) = 𝒔(𝒔𝟐+𝟒𝒔+𝟓) and locate closed loop poles in
the complex s-plane
MATLAB CODE:
num= [O O O 1];
den = [1 4 5 O];
rlocus(num, den);
v = [-3 1 -2 2]; axis(v); axis('square')
sgrid(O.5, [])
[K,r] = rlocfind(num, den)
Select a point in the graphics window
selected-point =
-O.6246 + 1.O792i
K=
4.2823
r=
-2.7474
-O.6263 + 1.O8OOi
-O.6263 - 1.O8O0i

Output:
𝑪(𝒔) 𝟏𝟎𝒔+𝟒
Plot the unit-step response curve for a large overshoot for transfer function 𝑹(𝒔) = 𝒔𝟐+𝟒𝒔+𝟒

Matlab Code:
num = [O 1O 4];
den = [1 4 4];
t = O:O.O2:1O];
y = step(num,den,t);
plot(t,y)
grid
title('Unit-Step Response')
xlabel('t (sec)')
ylabel('Output')
numl = [O O 1O 4];
den1 = [1 4 4 O];
yl = step(num1 ,den1 ,t);
plot(t,t,'--',t,yl )
v = [O 1 0 0 101; axis(v);
grid
title('Unit-Ramp Response')
xlabel('t (sec)')
ylabel('Unit-Ramp Input and Output')
text(6.1 ,5.O,'Unit-Ramp Input')
te~t(3.5,7.1 ,'Output)
Output:

𝑲(𝒔𝟐 +𝟐𝟓)𝒔
Plot the Root locus for a feedforward transfer function 𝑮(𝒔) = .
(𝒔𝟒 +𝟒𝟎𝟒𝒔𝟐 +𝟏𝟔𝟎𝟎)

Matlab Code:
num = [O 1 O 25 O];
den = [1 O 4O4 O 16OO];
K = O:O.4:1OOO;
rlocus(num,den,K)
v = [-3O 2O -25 25]; axis(v); axis('square')
grid
title('Root-Locus Plot of G(s) = K(s^2 + 25)s/(s^4 + 4O4s^2 + 16OO)')
Output:

You might also like