Assignment 02: PES2UG19EC097

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

PES2UG19EC097

ASSIGNMENT 02
4. The objective of this exercise is to deduce the effect of location of pole and zero on the time-domain response of a
system.

a. First-order systems: Consider 𝐺1 (𝑠) = 1/𝑠+ . Compare in terms of rise time and steady-state value the step
responses of this system for different values of p. Choose p = 0.5, 1, 2, and 10. (For purposes of this
experiment, assume the following definition of rise time: the time taken for the output to reach 90% of the
final steady-state value.) Based on this, where should one locate the pole if the requirement is a fast
response? Where should one locate the pole if the steady-state value of the output is expected to be equal to
the input value? Can one independently satisfy both requirements?

%PES2UG19EC097
% 4 a) First order system
clc;
clear all;
close all;
k=4;
% To consider an array of p values
p=[0.5,1,2,10];
% To print the various Transfer functions
Transfuncf1=tf(1,[1,0.5])
Transfuncf2=tf(1,[1,1])
Transfuncf3=tf(1,[1,2])
Transfuncf4=tf(1,[1,10])

% To find various rise time values


Tr=zeros(k);
for c=1:k
Tr(c)=2.3/p(c);
end
% The lower the rise time faster is the response
Min_Tr=min(Tr);
disp("Fastest response is shown at rise time");
M = Min_Tr(1)
% we consider the steady state value as 1 hence G(s)=1
%S=zeros(k);
for t=1:k
S(t)=1-p(t);
end
disp("The locations of poles must be:");
S
%Plots of each transfer functions
stepplot(Transfuncf1)
stepplot(Transfuncf2)
stepplot(Transfuncf3)
stepplot(Transfuncf4)

OUTPUT :
PES2UG19EC097
PES2UG19EC097

b. Second-order systems: Consider 𝐺2 (𝑠) = 10 𝑠/2+𝑎𝑠+10 . Compare in terms of rise time, the settling time,
the peak overshoot, and steady-state value the step responses of this system for different values of a:
Choose a = 0.1, 2.5, 5, 7.5, 10. (Use the definitions in the prescribed text-book.) Ask questions similar to that
in 4.a, and discuss the results.
PES2UG19EC097

%PES2UG19EC097
%4 b) Second order system
clc;
clear all;
close all;
k1=5;
k2=5;
% values of a
a=[0.1,2.5,5,7.5,10];
% transfer functions
TF1=tf([10],[1,0.1,10])
TF2=tf([10],[1,2.5,10])
TF3=tf([10],[1,5,10])
TF4=tf([10],[1,7.5,10])
TF5=tf([10],[1,10,10])
% Damping ratio and natural frequency
% E - damping ratio = a/(2.Wn) and Wn=sqrt(10)
E=zeros(k1);
Wn= 3.162;
Wn1= 2*Wn;
for c=1:k1
E(c)=a(c)/Wn1;
end
% Computation of Wd
Wd1= zeros(k1);
theta= zeros(k1);
for c=1:k1
Wd1(c)=sqrt(1-E(c));
theta(c)= acos(E(c));
end
Wd=Wn*Wd1;
% Computation of theta, rise time, peak time, peak overshoot
% Computation of settling time
Tr= zeros(k2);
Tp= zeros(k2);
Mp= zeros(k2);
Ts= zeros(k2);
for c=1:k2
Tr(c)=(pi-theta(c))/Wd(c);
Tp(c)=pi/Wd(c);
Mp(c)=expm((-pi*E(c))/Wd1(c));
Ts(c)=4/(E(c)*Wn);
end
% 1) To check for faster response
% For faster response rise time should decrease
% Subsequent values for peak time, peak overshoot and settling time is
% taken
Min_Tr=min(Tr);
k=find(min(Tr));
disp("For the faster response")
disp("Rise Time:")
Min_Tr(1)
disp("Peak time:")
Tp(k)
disp("Peak overshoot:")
Mp(k)
disp("Settling time:")
PES2UG19EC097

Ts(k)

% 2) To get poles at steady state value


S1=0;
for c=1:k1
S2=2*Wn*E(c);
disp("The poles for a:");
a(c)
disp("is");
S1
S2
end
PES2UG19EC097
PES2UG19EC097
PES2UG19EC097

c. The effect of an additional pole: Consider 𝐺3 (𝑠) = 10/𝑠^2+2𝑠+10 in cascade with a first order system 𝐺4 (𝑠)
= 𝑝/𝑠+ . Repeat the experiment 4.b for different values of p. Choose p = 5, 10, 20. In your discussions,
include as well a comparison of these results with those obtained in 4.b.

%PES2UG19EC097
% 4 c) Effect of adding a pole to a transfer function
PES2UG19EC097

% For p=5 and poles(steady state) are given by


g1=tf(10,[1 2 10]);
f1=tf(5,[1 5]);
h1=series(g1,f1);
display(h1)
stepinfo(h1)
disp("Poles at steady state value are")
s1=[0 -2 -5]
% For p=10 and poles(steady state) are given by
g2=tf(10,[1 2 10]);
f2=tf(5,[1 5]);
h2=series(g2,f2);
display(h2)
stepinfo(h2)
disp("Poles at steady state value are")
s2=[0 -2 -10]
% For p=20 and poles(steady state) are given by
g3=tf(10,[1 2 10]);
f3=tf(5,[1 5]);
h3=series(g3,f3);
display(h3)
stepinfo(h3)
disp("Poles at steady state value are")
s3=[0 -2 -20]
stepplot(h3)

OUTPUT:
h1 =

50
-----------------------
s^3 + 7 s^2 + 20 s + 50

Continuous-time transfer function.

ans =

struct with fields:

RiseTime: 0.5131
TransientTime: 3.6966
SettlingTime: 3.6966
SettlingMin: 0.9006
SettlingMax: 1.2824
Overshoot: 28.2355
Undershoot: 0
Peak: 1.2824
PeakTime: 1.2710
PES2UG19EC097

Poles at steady state value are

s1 =

0 -2 -5

h2 =

50
-----------------------
s^3 + 7 s^2 + 20 s + 50

Continuous-time transfer function.

ans =

struct with fields:

RiseTime: 0.5131
TransientTime: 3.6966
SettlingTime: 3.6966
SettlingMin: 0.9006
SettlingMax: 1.2824
Overshoot: 28.2355
Undershoot: 0
Peak: 1.2824
PeakTime: 1.2710

Poles at steady state value are

s2 =

0 -2 -10

h3 =
PES2UG19EC097

50
-----------------------
s^3 + 7 s^2 + 20 s + 50

Continuous-time transfer function.

ans =

struct with fields:

RiseTime: 0.5131
TransientTime: 3.6966
SettlingTime: 3.6966
SettlingMin: 0.9006
SettlingMax: 1.2824
Overshoot: 28.2355
Undershoot: 0
Peak: 1.2824
PeakTime: 1.2710

Poles at steady state value are

s3 =

0 -2 -20
PES2UG19EC097

d. The effect of an additional zero: Consider 𝐺4 (𝑠) = 10( /𝑎 +1)/𝑠^2+2𝑠+10 . Repeat the experiment 4.b for
different values of a. Choose a = 0.1, 1, 10, 100. In your discussion, include as well a comparison of these results
with those obtained in 4.b.

% 4d) Effect on the second order system due to addition of a zero


clc;
clear all;
close all;
% For a=0.1 and poles(steady state) are given by
g1=tf([10/0.1 10],[1 2 10]);
display(g1)
stepinfo(g1)
disp("Poles at steady state value are")
s1=[0 98]
% For a=1 and poles(steady state) are given by
g2=tf([10 10],[1 2 10]);
display(g2)
stepinfo(g2)
disp("Poles at steady state value are")
s2=[0 8]
% For a=10 and poles(steady state) are given by
g3=tf([10/10 10],[1 2 10]);
display(g3)
stepinfo(g3)
PES2UG19EC097

disp("Poles at steady state value are")


s3=[0 -1]
% For a=100 and poles(steady state) are given by
g4=tf([10/100 10],[1 2 10]);
display(g4)
stepinfo(g4)
disp("Poles at steady state value are")
s3=[0 -1.9]
stepplot(g2)

OUTPUT:

g1 =

100 s + 10
--------------
s^2 + 2 s + 10

Continuous-time transfer function.

ans =

struct with fields:

RiseTime: 0.0084
TransientTime: 3.9626
SettlingTime: 7.0744
SettlingMin: -6.1753
SettlingMax: 21.4323
Overshoot: 2.0432e+03
Undershoot: 617.5283
Peak: 21.4323
PeakTime: 0.4145

Poles at steady state value are

s1 =

0 98
PES2UG19EC097

g2 =

10 s + 10
--------------
s^2 + 2 s + 10

Continuous-time transfer function.

ans =

struct with fields:

RiseTime: 0.0855
TransientTime: 4.0599
SettlingTime: 4.9646
SettlingMin: 0.3764
SettlingMax: 2.7745
Overshoot: 177.4549
Undershoot: 0
Peak: 2.7745
PeakTime: 0.5066

Poles at steady state value are

s2 =

0 8

g3 =

s + 10
--------------
s^2 + 2 s + 10

Continuous-time transfer function.

ans =
PES2UG19EC097

struct with fields:

RiseTime: 0.3934
TransientTime: 3.4405
SettlingTime: 3.4405
SettlingMin: 0.8700
SettlingMax: 1.3699
Overshoot: 36.9931
Undershoot: 0
Peak: 1.3699
PeakTime: 0.9210

Poles at steady state value are

s3 =

0 -1

g4 =

0.1 s + 10
--------------
s^2 + 2 s + 10

Continuous-time transfer function.

ans =

struct with fields:

RiseTime: 0.4247
TransientTime: 3.5259
SettlingTime: 3.5259
SettlingMin: 0.8769
SettlingMax: 1.3503
Overshoot: 35.0254
Undershoot: 0
Peak: 1.3503
PeakTime: 1.0592
PES2UG19EC097

Poles at steady state value are

s3 =

0 -1.9000

CONCLUSION:

is the peak overshoot increases, peak time and rise time both decreases.

5. The objective of this exercise is to compare the response of systems to different kinds of inputs. Consider the two
systems 𝐺3 (𝑠) = 10 𝑠 2+2𝑠+10 and 𝐺3 (𝑠) = 10(𝑠+1) 𝑠 3+10𝑠 2+10𝑠+10. Compare the responses of these systems to a
step input and a unit-ramp input. Do the outputs follow or track the input? If so, why? If not, why not? Can one
theoretically deduce these results?

clc;
g1_1=tf(10,[1 2 10]);
g2_1=tf([10 10],[1 10 10 10]);
g3_1=tf(10,[1 2 10 0]);
g4_1=tf([10 10],[1 10 10 10 0]);
subplot(1,2,1);
step(g1_1,'b',g2_1,'r');
legend('G1=10/s^2+2s+10','G2=10(s+1)/s^3+10s^2+10s+10');
PES2UG19EC097

subplot(1,2,2);
step(g3_1,'bo',g4_1,'r.');
legend('G1=10/s^2+2s+10','G2=10(s+1)/s^3+10s^2+10s+10');

6. The objective of this exercise is to deduce the effect of feedback on a system, specifically, a boring machine.
(What were the boring machines that have been used for the “Namma Metro” construction?) The machines
operating from both ends of a tunnel bore toward the middle. To link up accurately in the middle of the tunnel, a
laser guidance system keeps the machines precisely aligned. (What would happen if this is not ensured?)

% 6.1 Namma Metro


s = tf('s');
PES2UG19EC097

Ga = 1/(s^2+s);
Gb = 1/(s^2+2*s);
Gc = 1/(s^2+5*s);
subplot(2,2,1);
impulse(Ga,Gb,Gc);
legend('p=1','p=2','p=5');
subplot(2,2,2);
step(Ga,Gb,Gc);
legend('p=1','p=2','p=5');
t = (0:800)/100;
u = 0*t;
u(t>0 & t<=4) = 1;
u(t>4 & t<=8) = 2;
subplot(2,2,3);
y1 = lsim(Ga,u,t);
y2 = step(Ga,t);
y3 = y1 + y2;
S1 = stepinfo(y3,t);
disp(S1);
y4 = lsim(Gb,u,t);
y5 = step(Gb,t);
y6 = y4 + y5;
S2 = stepinfo(y6,t);
disp(S2);
y7 = lsim(Gc,u,t);
y8 = step(Gc,t);
y9 = y7 + y8;
S3 = stepinfo(y9,t);
disp(S3);
plot(t,y3);
hold on;
PES2UG19EC097

OUTPUT:

RiseTime: 7.0727
TransientTime: 7.8896
SettlingTime: 7.8896
SettlingMin: 9.9339
SettlingMax: 10.9206
Overshoot: 0
Undershoot: 0
Peak: 10.9206
PeakTime: 8

RiseTime: 7.2580
TransientTime: 7.8710
SettlingTime: 7.8710
SettlingMin: 5.8503
SettlingMax: 6.4501
Overshoot: 0
Undershoot: 0
Peak: 6.4501
PeakTime: 8

RiseTime: 7.1198
TransientTime: 7.8350
SettlingTime: 7.8350
SettlingMin: 2.9800
SettlingMax: 3.3000
PES2UG19EC097

Overshoot: 0
Undershoot: 0
Peak: 3.3000
PeakTime: 8

RiseTime: 7.2820
TransientTime: 7.8896
SettlingTime: 7.8896
SettlingMin: 9.9339
SettlingMax: 10.9206
Overshoot: 0
Undershoot: 0
Peak: 10.9206
PeakTime: 8

RiseTime: 7.2779
TransientTime: 7.8710
SettlingTime: 7.8710
SettlingMin: 5.8503
SettlingMax: 6.4501
Overshoot: 0
Undershoot: 0
Peak: 6.4501
PeakTime: 8

RiseTime: 7.1316
TransientTime: 7.8350
SettlingTime: 7.8350
SettlingMin: 2.9800
SettlingMax: 3.3000
Overshoot: 0
Undershoot: 0
Peak: 3.3000
PeakTime: 8

assign1_6_1
RiseTime: 5.7652
TransientTime: 7.8858
SettlingTime: 7.8858
SettlingMin: 15.3137
SettlingMax: 17.0091
Overshoot: 0
Undershoot: 0
Peak: 17.0091
PeakTime: 8

RiseTime: 5.9873
TransientTime: 7.8767
SettlingTime: 7.8767
SettlingMin: 8.3303
SettlingMax: 9.2451
Overshoot: 0
Undershoot: 0
Peak: 9.2451
PeakTime: 8

RiseTime: 6.1822
TransientTime: 7.8707
SettlingTime: 7.8707
SettlingMin: 3.4940
PES2UG19EC097

SettlingMax: 3.8780
Overshoot: 0
Undershoot: 0
Peak: 3.8780
PeakTime: 8

assign1_6_1
RiseTime: 5.7652
TransientTime: 7.8858
SettlingTime: 7.8858
SettlingMin: 15.3137
SettlingMax: 17.0091
Overshoot: 0
Undershoot: 0
Peak: 17.0091
PeakTime: 8

RiseTime: 5.9873
TransientTime: 7.8767
SettlingTime: 7.8767
SettlingMin: 8.3303
SettlingMax: 9.2451
Overshoot: 0
Undershoot: 0
Peak: 9.2451
PeakTime: 8

RiseTime: 6.1822
TransientTime: 7.8707
SettlingTime: 7.8707
SettlingMin: 3.4940
SettlingMax: 3.8780
Overshoot: 0
Undershoot: 0
Peak: 3.8780
PeakTime: 8

clc;
s = tf('s');
%G block for different p values
Ga = 1/(s^2+s);
PES2UG19EC097

Gb = 1/(s^2+2*s);
Gc = 1/(s^2+5*s);
%G1 block
G1_i = 11*s + 20; %K=20
G1_ii = 11*s + 100; %K =100
%Transfer function when D(S)=0 | K= 20 for different p values
G_i_a = feedback(G1_i*Ga,1);
G_i_b = feedback(G1_i*Gb,1);
G_i_c = feedback(G1_i*Gc,1);
%Transfer function when D(S)=0 | K= 100 for different p values
G_ii_a = feedback(G1_ii*Ga,1);
G_ii_b = feedback(G1_ii*Gb,1);
G_ii_c = feedback(G1_ii*Gc,1);
figure(1);
%Impulse responses
subplot(2,2,1);
impulse(G_i_a,G_i_b,G_i_c);
legend('p=1','p=2','p=5');
title('Impulse Response | K = 20');
subplot(2,2,3);
impulse(G_ii_a,G_ii_b,G_ii_c);
legend('p=1','p=2','p=5');
title('Impulse Response | K = 100');
%Step Responses
subplot(2,2,2);
step(G_i_a,G_i_b,G_i_c);
legend('p=1','p=2','p=5');
title('Step Response | K = 20');
subplot(2,2,4);
step(G_ii_a,G_ii_b,G_ii_c);
legend('p=1','p=2','p=5');
title('Step Response | K = 100');
figure(2);
%Disturbance input
t = 0:0.1:8;
d_a = ones(size(0:0.1:4));
d_b = 2*ones(size(4.1:0.1:8));
d = [d_a d_b];
Yd_i=lsim(Ga,d,t);%disturbance effect p =1
Yd_ii=lsim(Gb,d,t);%disturbance effect K =5
Yd_iii=lsim(Gc,d,t);%disturbance effect K =10
%K = 20
Y1_i_a= step(G_i_a,t);
Y1_i_b= step(G_i_b,t);
Y1_i_c= step(G_i_c,t);
Y_i_a = Y1_i_a + Yd_i;
Y_i_b = Y1_i_b + Yd_ii;
Y_i_c = Y1_i_c + Yd_iii;
Si_a = stepinfo(Y_i_a,t);
Si_b = stepinfo(Y_i_b,t);
Si_c = stepinfo(Y_i_c,t);
disp(Si_a);
disp(Si_b);
disp(Si_c);
subplot(2,1,1);
plot(t,Y_i_a);
hold on;
plot(t,Y_i_b);
hold on;
PES2UG19EC097

plot(t,Y_i_c);
hold off;
title('Step Response with Disturbance input | K = 20');
legend('p=1','p=2','p=5');
%K = 100
Y1_ii_a= step(G_ii_a,t);
Y1_ii_b= step(G_ii_b,t);
Y1_ii_c= step(G_ii_c,t);
Y_ii_a = Y1_ii_a + Yd_i;
Y_ii_b = Y1_ii_b + Yd_ii;
Y_ii_c = Y1_ii_c + Yd_iii;
Sii_a = stepinfo(Y_ii_a,t);
Sii_b = stepinfo(Y_ii_b,t);
Sii_c = stepinfo(Y_ii_c,t);
disp(Sii_a);
disp(Sii_b);
disp(Sii_c);
subplot(2,1,2);
plot(t,Y_ii_a);
hold on;
plot(t,Y_ii_b);
hold on;
plot(t,Y_ii_c);
hold off;
title('Step Response with Disturbance input | K = 100');
legend('p=1','p=2','p=5');
PES2UG19EC097

RiseTime: 7.0727
TransientTime: 7.8896
SettlingTime: 7.8896
SettlingMin: 9.9339
SettlingMax: 10.9206
Overshoot: 0
Undershoot: 0
Peak: 10.9206
PeakTime: 8

RiseTime: 7.2580
TransientTime: 7.8710
SettlingTime: 7.8710
SettlingMin: 5.8503
SettlingMax: 6.4501
Overshoot: 0
Undershoot: 0
Peak: 6.4501
PeakTime: 8

RiseTime: 7.1198
TransientTime: 7.8350
SettlingTime: 7.8350
SettlingMin: 2.9800
SettlingMax: 3.3000
Overshoot: 0
Undershoot: 0
PES2UG19EC097

Peak: 3.3000
PeakTime: 8

RiseTime: 7.2820
TransientTime: 7.8896
SettlingTime: 7.8896
SettlingMin: 9.9339
SettlingMax: 10.9206
Overshoot: 0
Undershoot: 0
Peak: 10.9206
PeakTime: 8

RiseTime: 7.2779
TransientTime: 7.8710
SettlingTime: 7.8710
SettlingMin: 5.8503
SettlingMax: 6.4501
Overshoot: 0
Undershoot: 0
Peak: 6.4501
PeakTime: 8

RiseTime: 7.1316
TransientTime: 7.8350
SettlingTime: 7.8350
SettlingMin: 2.9800
SettlingMax: 3.3000
Overshoot: 0
Undershoot: 0
Peak: 3.3000
PeakTime: 8

You might also like