Final CS
Final CS
Teacher In-charge:
Dr. Neetu Sehrawat
INDEX
S.
Name of the Experiment Date Remark
No.
Experiment: 01
Aim: To determine the step and impulse response for the given
second order unity feedback system:
1
a. 2
s + 2 s+3
s+1
b. 2
s + 2 s+3
1
a. 2
s + 2 s+3
Code:
clear all;
close all;
num1 = [0,1];
den1 = [1,2,3];
tf1 = tf(num1, den1);
tf2 = tf ([0,0,1],[0,0,1]);
tf3 = feedback(tf1,tf2);
%impulse response of transfer function
imp = impulse(tf3);
subplot(2,1,1);
plot(imp);
title('impulse response');
xlabel('time');
ylabel('amplitude');
%step response of transfer function
st = step(tf3);
subplot(2,1,2);
plot(st);
title('step response');
xlabel('time');
ylabel('amplitude');
Output:
Code:
clc;
clear all;
close all;
num1 = [1,1];
den1 = [1,2,3];
tf1 = tf(num1, den1);
tf2 = tf ([0,0,1],[0,0,1]);
tf3 = feedback(tf1,tf2);
%impulse response of transfer function
imp = impulse(tf3);
subplot(2,1,1);
plot(imp);
title('impulse response');
xlabel('time');
ylabel('amplitude');
%step response of transfer function
st = step(tf3);
subplot(2,1,2);
plot(st);
title('step response');
xlabel('time');
ylabel('amplitude')
Output;
Code:
clc;
clear all;
close all;
num =[0,0,25];
den = [1,6 ,25];
sys =tf(num,den);
step(sys);
wn = sqrt(den(end));
zeta = den(2)/(2*wn);
k = sqrt(1-(zeta^2));
wd = wn*k;
fi = atan((k)/zeta);
tr=(pi-fi)/wd;
tp=(pi/wd);
tss=(4/zeta*wn);
mp=exp((-pi*zeta)/k)*100; display(tr)
display(tp)
display(tss)
display(mp)
Output:
Peak time
Rise time
Time (Seconds)
Simulink Design for above system:
s+ 1
b. 2
s + 2 s+ 4
2
2 s +3 s
c. 2
s+ +
1 1
√2 4
2
s + 25
d. 2
s + 1.8 s+ 25
Code:
% ( s + 10) /( s³ + 6s² + 9s + 10)
num1= [1 ,10];
den1 = [ 1,6, 9,10];
sys1 = tf(num1,den1);
% (s + 1)/ ( s²+ 2s + 4)
num2=[1,1];
den2=[1,2,4];
sys2=tf(num2,den2);
% (2s²+ 3s)/(s²+ 1/√2 + 1/4)
num3=[2,3,0];
den3=[1,1/sqrt(2),1/4];
sys3 = tf(num3,den3);
% (s²+25)/(s² + 1.8s + 25)
num4= [1,0,25];
den4 = [1,1.8,25];
sys4 = tf(num4,den4);
figure;
%plot the pole zeroes to verify that they arein expected location.
subplot(2,2,1);
pzmap(sys1)
[z,p,k] = tf2zp(num1,den1)
zplane(num1,den1)
text(real(z)+ 0.1,imag(z), 'zero')
text(real(p)+ 0.1,imag(p), 'pole')
title('pole - zero plot');
xlabel('real');
ylabel('imaginary');
%plot the pole zeroes to verify that they arein expected location.
subplot(2,2,2);
pzmap(sys2)
[z,p,k] = tf2zp(num2,den2)
zplane(num2,den2)
text(real(z)+ 0.1,imag(z), 'zero')
text(real(p)+ 0.1,imag(p), 'pole')
title('pole - zero plot');
xlabel('real');
ylabel('imaginary');
%plot the pole zeroes to verify that they are in expected location.
subplot(2,2,3);
pzmap(sys3)
[z,p,k] = tf2zp(num3,den3)
zplane(num3,den3)
text(real(z)+ 0.1,imag(z), 'zero')
text(real(p)+ 0.1,imag(p), 'pole')
title('pole - zero plot');
xlabel('real');
ylabel('imaginary');
%plot the pole zeroes to verify that they are in expected location.
subplot(2,2,4);
pzmap(sys4)
[z,p,k] = tf2zp(num4,den4)
zplane(num4,den4)
text(real(z)+ 0.5,imag(z), 'zero')
text(real(p)-2,imag(p), 'pole')
title('pole - zero plot');
xlabel('real');
ylabel('imaginary')
Output:
Experiment : 04:
Aim: Sketch the root locus plot:
1. For the open loop transfer function
2
s +4
a. G(s)h(s)=k
s ( s+ 2 )
s +12
b. G(s)H(s)= 2 (
s s+20 )
2
s +4
1.a. G(s)h(s)=k (
s s+ 2 )
Code:
clc;
clear all;
close all;
num=[1,0,4];
den=[1,2,0];
g=tf(num,den)
t=feedback(g,1);
rlocus(g);
Output:
s +12
1.b. G(s)H(s)= 2 (
s s+20 )
Code:
clc;
clear all;
close all;
num=[1,12];
den=[1,20,0,0];
g=tf(num,den);
t=feedback(g,1);
rlocus(g);
Output:
s+2
2.a. G(s)h(s)=k (
s s+ 1 ) ( s 2+ 4 s+16 )
Code:
clc;
clear all;
close all;
num=[1,2];
den=[1,5,20,16,0];
g=tf(num,den);
rlocus(g);
Output:
k
2.b. G(s)H(s)= (
s s+ 4 ) ( s 2+ 4 s+20 )
Code:
clc;
clear all;
close all;
num=1;
den=[1,8,36,80,0];
g=tf(num,den);
rlocus(g);
Output:
Experiment :05
Aim: A unity feedback control system has its forward path
transfer function:
210
G(s) = (
s s+ 2 ) ( s 2+12 s+6 )
Output:
Experiment 06:
AIM: For the open loop transfer function:
1
a. G(s)= 2
s + 8 s +1
4 s+ 1
b. G(s)= 2
s + 8 s +1
s +2
c. G(s)= ( s +1 )( s−1 )
1
a. G(s)= 2
s + 8 s +1
Code:
clc;
clear all;
close all;
num=[1];
den=[1 8 1];
sys=tf(num,den);
nyquist(sys);
Output:
4 s+ 1
b. G(s)= s 2+ 8 s +1
Code:
clc;
clear all;
close all;
num=[4 1];
den=[2 3 1 0 0];
sys=tf(num,den);
nyquist(sys);
Output:
s +2
c. G(s)= ( s +1 )( s−1 )
Code:
clc;
clear all;
close all;
num=[1 2];
den=[10 (-1)];
sys=tf(num,den);
nyquist(sys);
Output:
Experiment : 07 (Code)
Aim: Comparison of open loop and closed loop control in speed
control of DC motor and to find the transfer function .Draw the
corresponding graph.
Code:
clc;
clear all;
close all;
err = [3 4 5 6 7 8 9 10];
gain_nofba1= [1195 1830 2590 3370 3871 3836 3845 3852];
gain_nofba10= [4334 4337 4340 4343 4345 4346 4347 4350];
subplot(2,2,1);
plot(err,gain_nofba1);
xlabel=('Error Gain');
ylabel=('RPM');
title=('RPM vs Error without feedback(Amp Gain 1)');
subplot(2,2,2);
plot(err,gain_nofba10);
xlabel=('Error Gain');
ylabel=('RPM');
title=('RPM vs Error without feedback(Amp Gain 10)');
subplot(2,2,3);
plot(err,gain_fba1);
xlabel=('Error Gain');
ylabel=('RPM');
title=('RPM vs Error with feedback(Amp Gain 1)');
subplot(2,2,4);
plot(err,gain_fba10);
xlabel=('Error Gain');
ylabel=('RPM');
title=('RPM vs Error with feedback(Amp Gain 10)');
Output:
Experiment: 07
AIM:- Comparison was open loop and closed loop control in
speed control of DC motor and to find the transfer function.
Draw the corresponding graph.
Theory:
PROCEDURE
In tus case motor is allowed to run without a feedback. So, the switch S is kept
at upper side. Let VDGV or 67V (reference) and it can be adjusted by the given
potentiometer and measure on DVM Connect DVM with feedback socket and
note that the speed in rpm for display output VR.
Record N in Vr for successive gain 3,4, 5....10.
Calculate motor driver voltage au Vn= Vr.k where k is given as gain
> Plot N vs Vm. Find motor speed from linear region at curve km = 1/k where
K = shaft
speed/'motor voltage = Wss/Vm, km = Vm/Wss, kr =Vr/Wss