Control Assignment 2 PDF
Control Assignment 2 PDF
Semester 1 2019/2020
BEKC 3523
Control System Engineering
Assignment
𝐾(𝑆 + 1)
𝐺 (𝑆) =
(𝑆 + 2)(𝑆 + 3)
𝑗𝑤
𝐾(𝑗𝑤 + 1) 𝐾( 1 + 1)1
𝐺 (𝑆) = 𝐺 (𝑆) =
(𝑗𝑤 + 2)(𝑗𝑤 + 3) 𝑗𝑤 𝑗𝑤
2( 2 + 1)( 3 + 1)3
𝐾(𝑗𝑤 + 1)
𝐺 (𝑆) =
𝑗𝑤 𝑗𝑤
6( 2 + 1)( 3 + 1)
Term 1 2 3
𝑗𝑤 + 1 +20 +20 +20
1 0 -20 -20
𝑗𝑤
2 +1
1 0 0 -20
𝑗𝑤
3 +1
Total +20 0 -20
For phase frequency response:
function bode_as1(num,den);
num=[1 1];
den=[1 5 6]
zroots=roots(num);
proots=roots(den);
[iz,~]=find(abs(zroots)==0);
numz=length(iz);
[ip,jp]=find(abs(proots)==0);
nump=length(ip);
pend=numz-nump;
sz=[1:length(zroots)];
sp=[1:length(proots)];
zroots=zroots(setdiff(sz,iz),:);
proots=proots(setdiff(sp,ip),:);
zroots2=abs(zroots)-j*real(zroots)./abs(zroots);
proots2=abs(proots)-j*real(proots)./abs(proots);
zz=ones(size(zroots2,1),3);
zz(:,2)=real(zroots2);
zz(:,3)=imag(zroots2);
pp=-ones(size(proots2,1),3);
pp(:,2)=real(proots2);
pp(:,3)=imag(proots2);
%tracciamento moduli
pp_mag=pp;
zz_mag=zz;
vect=[zz_mag;pp_mag];
vect=sortrows(vect,2);
interval=zeros(1,size(vect,1)+2);
interval(:,[2:(size(vect,1)+1)])=vect(:,2)';
try
interval(1,1)=0.01*vect(1,2);
interval(1,end)=100*vect(end,2);
catch
interval(1,1)=0.01*1;
interval(1,2)=100*1;
end
[g,p]=bode(num,den,interval(1));grid on
y(1)=20*log10(g);
indice=2;
y_old=y(1);
i_old=interval(1);
for i=interval(:,[2:length(interval)-1])
y(indice)=20*pend*log10(i)+y_old-
20*pend*log10(i_old);
pend=pend+vect(indice-1,1);
i_old=i;
y_old=y(indice);
indice=indice+1;
end
y(indice)=20*pend*log10(interval(end))+y_old-
20*pend*log10(i_old);
subplot(2,1,1)
semilogx(interval,y,'r');
hold on;
%plot(interval,y,'go');
grid on
%grid on;
indice=1;
hold on;
[AAA,BBB,CCC,DDD]=tf2ss(num,den);
sys=ss(AAA,BBB,CCC,DDD);
%bodemag(sys);
[m1,m2,m3]=bode(num,den,{interval(1,1),interval(1,end)});
hold on;
plot(m3,20*log10(m1));grid on
clear interval;
%tracciamento fasi
[ii,jj]=find(vect(:,3)<0)
vect(ii,1)=-(vect(ii,1));
for i=1:size(vect,1)
interval(1,indice)=0.1*vect(i,2);
interval(2,indice)=vect(i,1);
indice=indice+1;
interval(1,indice)=vect(i,2);
interval(2,indice)=0;
indice=indice+1;
interval(1,indice)=10*vect(i,2);
interval(2,indice)=-vect(i,1);
indice=indice+1;
end
try
interval=interval';
interval=sortrows(interval,1);
interval=interval';
catch
interval(:,1)=[0.01*1;0];
interval(:,2)=[100*1;0];
interval=interval';
interval=sortrows(interval,1);
interval=interval';
end
interval=[[0.1*interval(1,1);0] interval
[10*interval(1,end);0]];
[g,p,w3]=bode(num,den,interval(1));grid on
pp=p;
x=round(p/90);
p=90*x;
yf(1)=p;
indice=2;
yf_old=yf(1);
i_old=interval(1,1);
pend=0;
for i=interval(1,[2:size(interval,2)-1])
yf(indice)=45*pend*log10(i)+yf_old-
45*pend*log10(i_old);
pend=pend+interval(2,indice);
i_old=i;
yf_old=yf(indice);
indice=indice+1;
end
yf(indice)=yf_old;
subplot(2,1,2)
semilogx(interval(1,:),yf,'r');
hold on;
%plot(interval(1,:),yf,'go');
%grid on;
[m1,m2,m3]=bode(num,den,{interval(1,1),interval(1,end)});
grid on
diff=m2(1)-pp;
m2=m2-diff;
hold on
semilogx(m3,m2);grid on
To find the range of K, the closed-loop transfer function is
𝐾(𝑆+1)
(𝑆+2)(𝑆+3)
T(S) = ⁄ 𝐾(𝑆+1)
1 + (𝑆+2)(𝑆+3) (1)
𝐾(𝑆+1)
= (𝑆+2)(𝑆+3)+𝐾(𝑆+1)
= 𝑠 2 + 5s + 6 + Ks + K
= 𝑠 2 + (5+K) s + 6 + K
𝑠2 1 6+K
𝑠1 5+K 0
𝑠0 | 1 6+𝐾|
5+𝐾 0
| 1 0|
5+𝐾 0
− = 6+K − =0
5+𝐾 5+𝐾
6+K=0
K = -6
5+K=0
K = -5 (marginal stable)
When -6<K<-5, the transfer function is stable. If the K>-5, it means that the transfer function
is unstable.
4) Consider only the second-order poles (and with numerator of 50) of the same transfer
function, use Matlab to sketch the asymptotic Bode diagram.
num=[50];
den=[1 5 6]
zroots=roots(num);
proots=roots(den);
[iz,~]=find(abs(zroots)==0);
numz=length(iz);
[ip,jp]=find(abs(proots)==0);
nump=length(ip);
pend=numz-nump;
sz=[1:length(zroots)];
sp=[1:length(proots)];
zroots=zroots(setdiff(sz,iz),:);
proots=proots(setdiff(sp,ip),:);
zroots2=abs(zroots)-j*real(zroots)./abs(zroots);
proots2=abs(proots)-j*real(proots)./abs(proots);
zz=ones(size(zroots2,1),3);
zz(:,2)=real(zroots2);
zz(:,3)=imag(zroots2);
pp=-ones(size(proots2,1),3);
pp(:,2)=real(proots2);
pp(:,3)=imag(proots2);
%tracciamento moduli
pp_mag=pp;
zz_mag=zz;
vect=[zz_mag;pp_mag];
vect=sortrows(vect,2);
interval=zeros(1,size(vect,1)+2);
interval(:,[2:(size(vect,1)+1)])=vect(:,2)';
try
interval(1,1)=0.01*vect(1,2);
interval(1,end)=100*vect(end,2);
catch
interval(1,1)=0.01*1;
interval(1,2)=100*1;
end
[g,p]=bode(num,den,interval(1));grid on
y(1)=20*log10(g);
indice=2;
y_old=y(1);
i_old=interval(1);
for i=interval(:,[2:length(interval)-1])
y(indice)=20*pend*log10(i)+y_old-20*pend*log10(i_old);
pend=pend+vect(indice-1,1);
i_old=i;
y_old=y(indice);
indice=indice+1;
end
y(indice)=20*pend*log10(interval(end))+y_old-20*pend*log10(i_old);
subplot(2,1,1)
semilogx(interval,y,'r');
hold on;
%plot(interval,y,'go');
grid on
%grid on;
indice=1;
hold on;
[AAA,BBB,CCC,DDD]=tf2ss(num,den);
sys=ss(AAA,BBB,CCC,DDD);
%bodemag(sys);
[m1,m2,m3]=bode(num,den,{interval(1,1),interval(1,end)});
hold on;
plot(m3,20*log10(m1));grid on
clear interval;
%tracciamento fasi
[ii,jj]=find(vect(:,3)<0)
vect(ii,1)=-(vect(ii,1));
for i=1:size(vect,1)
interval(1,indice)=0.1*vect(i,2);
interval(2,indice)=vect(i,1);
indice=indice+1;
interval(1,indice)=vect(i,2);
interval(2,indice)=0;
indice=indice+1;
interval(1,indice)=10*vect(i,2);
interval(2,indice)=-vect(i,1);
indice=indice+1;
end
try
interval=interval';
interval=sortrows(interval,1);
interval=interval';
catch
interval(:,1)=[0.01*1;0];
interval(:,2)=[100*1;0];
interval=interval';
interval=sortrows(interval,1);
interval=interval';
end
interval=[[0.1*interval(1,1);0] interval [10*interval(1,end);0]];
[g,p,w3]=bode(num,den,interval(1));grid on
pp=p;
x=round(p/90);
p=90*x;
yf(1)=p;
indice=2;
yf_old=yf(1);
i_old=interval(1,1);
pend=0;
for i=interval(1,[2:size(interval,2)-1])
yf(indice)=45*pend*log10(i)+yf_old-45*pend*log10(i_old);
pend=pend+interval(2,indice);
i_old=i;
yf_old=yf(indice);
indice=indice+1;
end
yf(indice)=yf_old;
subplot(2,1,2)
semilogx(interval(1,:),yf,'r');
hold on;
%plot(interval(1,:),yf,'go');
%grid on;
[m1,m2,m3]=bode(num,den,{interval(1,1),interval(1,end)});grid on
diff=m2(1)-pp;
m2=m2-diff;
hold on
semilogx(m3,m2);grid on
5) Analyse the closed-loop characteristics of the system from the Bode diagrams plotted in
Q3 and Q4.
Bode diagrams are the graphically representing the frequency response of a linear
time-invariant system. The close loop system is the control system in which the output has an
effect on the input quantity in such a manner that the input quantity will adjust itself based on
the output generated. The close loop characteristics of the system by referring bode diagram
plotted in Q3 and Q4 is the system is a non-linear control system based on the relationship
between input and output on bode plot cannot be represented by a single linear
proportionality and the input and output related by some non-linear relation. Moreover, based
on the input in Q3 and Q4 bode diagram, there is no undesired input signal in the bode
diagram. Thus, there is no noise present in the close loop system. Bode diagram in Q3 and Q4
indicated good control system because it able to reduce the noise effect for the better
performance.
The steady state error constants can be directly obtained from the magnitude plot in
Q3 and Q4. Due to the Q3 and Q4 initial slope is zero, this prove that both are type zero of
the system.
16 dB = 20log Kp
Kp = 6.3095
19 dB = 20log Kp
Kp = 8.9125
We can conclude that the low frequency gain for bode diagram in Q3 is 6.3095 and for Q4 is
8.9125. The low frequency gain in Kp in Q4 is higher than Q3. Thus, the steady state error in
Q4 is lower compare to the Q3. Due to the steady state error in the close loop system is low,
both of the system have high accuracy. Then, the bode diagram in Q3 and Q4 high accurate
as any error arising is corrected due to the feedback signal in the close loop system. The
feedback loop is the tool which take the system output into consideration and enables the
system to adjust its performance to meet a desired result of the system. Due to the presence of
the feedback, the overall gain is reduced in the close loop system in Q3 and Q4.
The bandwidth is the frequency range in which the magnitude of the frequency
response drops 3dB from its low frequency value and use to measure the system ability to
reproduce an input signal and measure how fast is the system. The bandwidth in Q3 is 10
rad/sec and the bandwidth in Q4 is 2 rad/sec. The bandwidth in Q3 and Q4 is large for the
frequency response and consider as good control system.