Professional Documents
Culture Documents
>> p = [1 7 10]
p=
1 7 10
>> q = [1 2]
q=
1 2
>> y = conv(p,q);
>> y
y=
1 9 24 20
𝑦(𝑠) = 𝑠 + 9𝑠 + 24𝑠 + 20
( )
1.2) 𝐺(𝑠) =
( )
>> G = tf(q,p)
G=
s+2
--------------
s^2 + 7 s + 10
>> P = pole(G)
P=
-5
-2
>> Z = zero(G)
Z=
-2
Question 2
2.1)
Block Diagram 1
G1= tf([1],[1 1]);
G2= tf([1 0],[1 0 2]);
G3= tf([4 2],[1 2 1]);
G4= tf([1],[1 0 0]);
G5= tf([1 0 2],[1 0 0 14]);
H1= 4;
H2= 50;
Gs= series(G1,G2);
Gf1= feedback(G4,H2,1);
Gf2= feedback(Gs,G3,-1);
Gs2= series(Gf1,Gf2);
Gf3= feedback(Gs2,G5,-1);
Gs3= series(Gf3,H1);
Gs3 =
4 s^6 + 8 s^5 + 4 s^4 + 56 s^3 + 112 s^2 + 56 s
-------------------------------------------------------------------------------------------
s^10 + 3 s^9 - 45 s^8 - 125 s^7 - 200 s^6 - 1177 s^5 - 2344 s^4 - 3485 s^3 - 7668 s^2 - 5598 s - 1400
T = Gs3 =
4 s^6 + 8 s^5 + 4 s^4 + 56 s^3 + 112 s^2 + 56 s
-------------------------------------------------------------------------------------------
s^10 + 3 s^9 - 45 s^8 - 125 s^7 - 200 s^6 - 1177 s^5 - 2344 s^4 - 3485 s^3 - 7668 s^2 - 5598 s – 1400
pole(T)
ans =
7.0709 + 0.0000i
-7.0713 + 0.0000i
1.2051 + 2.0863i
1.2051 - 2.0863i
0.1219 + 1.8374i
0.1219 - 1.8374i
-2.3933 + 0.0000i
-2.3333 + 0.0000i
-0.4635 + 0.1997i
-0.4635 - 0.1997i
>> zero(T)
ans =
0.0000 + 0.0000i
1.2051 + 2.0872i
1.2051 - 2.0872i
-2.4101 + 0.0000i
-1.0000 + 0.0000i
-1.0000 - 0.0000i
>> pzmap(T)
Question 3
syms s
Gf1= feedback(G2,H1,-1);
Gs1= series(G1,G2);
Gf2= feedback(Gs1,G3,-1);
Gf3= feedback(Gf2,-1);
T= Gf3;
T =
5 s^4 + 160 s^3 + 1790 s^2 + 8160 s + 12285
------------------------------------------------------------------
s^8 + 133 s^7 + 6118 s^6 + 128896 s^5 + 1.397e06 s^4 + 7.944e06s^3 +
2.214e07 s^2 + 2.359e07 s - 8190
>> pole(T)
ans =
-64.0000
-31.9998
-11.9999
-10.0002
-8.0001
-4.0010
-2.9993
0.0003
From the poles above it can be seen that the last pole is approximately 0,
which mean one pole falls on the origin which makes this a type 1 system.
3.2)
Kp, Kv and Ka can be obtained using Matlabs PID tuner. This will provide the ideal
values for Kp,Kv and Ka.
syms s
Gf1= feedback(G2,H1,-1);
Gs1= series(G1,G2);
Gf2= feedback(Gs1,G3,-1);
Gf3= feedback(Gf2,-1);
T= Gf3;
pidTuner(T)
Tuned response for transfer function
Question 4
clear all
clc
syms s
num= sym2poly((s+3));
den= sym2poly(s*(s+2)*(s^2 +(3*s) + 10));
G= tf(num,den);
figure
step(G);
Because the given transfer function is of the 4th order open loop and unstable,
the step response happens fast and to infinity. To get a workable step response
, I added a positive unity feedback making a closed loop function as shown
below:
clear all
clc
syms s
num= sym2poly((s+3));
den= sym2poly(s*(s+2)*(s^2 +(3*s) + 10));
G= tf(num,den);
K=1;
G1= series(G,K)
G2=feedback(G1,1);
figure
step(G2);
Setting time, Rise time, peak time and percentage overshoot are shown in
graph above.
Question 5
𝐾𝑠(𝑠 + 2)
𝐺(𝑠) =
(𝑠 − 4𝑠 + 8)(𝑠 + 3)
From immediate observation it can be seen that a pole in the denominator will
lie in the right-hand plane making the system unstable.
When K=1
clear all
clc
syms s
K=1;
Gnum= sym2poly(s*(s+2));
Gden= sym2poly((s^2 -(4*s) + 8)*(s+3));
G= tf(Gnum,Gden);
H=1;
figure
rlocus(G*H*K);%open loop fuction
T= feedback(G*K,H);
figure
step(T);
figure
rlocus(T);%closed loop function
It can be seen from the root locus plot of the open loop function that the
system is unstable with two poles in the right hand plane while K=1.
From the observation above the root locus cuts the imaginary axis at K=5.
The step response for K=1 shows that the stability of the system is unstable.
When a gain of K=4 is applied to the system , it can be seen that the poles are
moving closer to the intersect of the imaginary axis.
The step response of the gain K=4 shows that the system is still unstable.
With the gain of K=5, the poles lie on the intersection of the imaginary axis.
The step response where the gain K=5. Although there is oscillation – the
system is stable.
With the gain of K=6, the poles move into the left hand side making the system
stable.
From the step response K=6, it can be seen that the system has become more
stable.
With K=10 the poles have moved further into the left side plane as shown
above.
The unit step response for gain K=10, shows that the system has less
oscillations and is stable.
In conclusion, it can be observed that for a gain where K<5 the system acts in
an unstable manner. It is also observed from the above results that the system
acts in a stable state where K>=5
Question 6
6.1)
syms s
K=1;
Gnum= 1;
Gden= sym2poly(s*(s+1)*(s+5)*(s+6));
G= tf(Gnum,Gden);
H=1;
T= feedback(G*K,H);
figure
rlocus(T); %closed loop function
pause
6.2)
syms s
K=1;
Gnum= 1;
Gden= sym2poly(s*(s+1)*(s+5)*(s+6));
G= tf(Gnum,Gden);
H=1;
T= feedback(G*K,H);
figure
rlocus(T);%closed loop function
pause
axis([-1 0 -2 2])
6.3)
syms s
K=1;
Gnum= 1;
Gden= sym2poly(s*(s+1)*(s+5)*(s+6));
G= tf(Gnum,Gden);
H=1;
T= feedback(G*K,H);
figure
rlocus(T); %closed loop function
pause
axis([-1 0 -2 2])
z=-log(pos/100)/sqrt(pi^2+(log(pos/100)^2));
sgrid(z,0) %Overlay overshoot line
6.4)
A 10% overshoot can be obtained at a gain K=14.2
syms s
K=14.2;
Gnum= 1;
Gden= sym2poly(s*(s+1)*(s+5)*(s+6));
G= tf(Gnum,Gden);
H=1;
T= feedback(G*K,H);
step(T)