You are on page 1of 5

Name: Sridhar Sundar

UID: 2021200115

Batch: TE EXTC B Division : B4

Experiment 9
Root Locus
syms s;
k=1;
gnum=k;
gden=sym2poly(s*(s+4)*(s+2));
disp('The transfer function is:')

The transfer function is:

g=tf(gnum,gden)

g =
1
---------------- s^3 + 6 s^2 +
8 s Continuous-time transfer
function.
Model Properties

rlocus(g)

1
Bode Plot
gnum=sym2poly(10*(-s+1));
gden=sym2poly(s*(s+2)*(s^2+2*s+27));
disp('The transfer function is:')

The transfer function is:

g=tf(gnum,gden)

g =
-10 s + 10
-------------------------- s^4
+ 4 s^3 + 31 s^2 + 54 s
Continuous-time transfer function.
Model Properties

[gain_margin_lin phase_margin wpc wgc]=margin(g);


gain_margin=mag2db(gain_margin_lin);
disp('Gain Crossover Frequency wgc ')

Gain Crossover Frequency wgc

wgc

wgc = 0.1878

disp('Gain Crossover Frequency wpc ')

Gain Crossover Frequency wpc

wpc

wpc = 1.2718

disp('Gain Margin G.M. ')

Gain Margin G.M.

gain_margin

gain_margin = 13.5389

disp('Phase Margin P.M. ')

Phase Margin P.M.

phase_margin

phase_margin = 73.1989

2
bode(g)

if(gain_margin>0&&phase_margin>0&&wgc<wpc)
disp('system is STABLE');
elseif(gain_margin<0&&phase_margin<0&&wgc>wpc)
disp('system is UNSTABLE') ;
elseif (wgc==wpc)
disp('system is MARGINALLY STABLE') ;
end

system is STABLE

Nyquist Plot
num=50; %num=60.........marginally stable and num>60.........unstable
den=[1 6 11 6];
disp('the transfer function is: ')

the transfer function is:

g=tf(num,den)

g =
50
--------------------- s^3 + 6
s^2 + 11 s + 6 Continuous-time
transfer function.
Model Properties

3
nyquist(g)

[gain_margin_lin phase_margin wpc wgc]=margin(g);


gain_margin=mag2db(gain_margin_lin);
disp('Gain Crossover Frequency wgc ')

Gain Crossover Frequency wgc

wgc

wgc = 3.0476

disp('Gain Crossover Frequency wpc ')

Gain Crossover Frequency wpc

wpc

wpc = 3.3166

disp('Gain Margin G.M. ')

Gain Margin G.M.

gain_margin

gain_margin = 1.5836

disp('Phase Margin P.M. ')

Phase Margin P.M.

4
phase_margin

phase_margin = 5.9903

if(gain_margin>0&&phase_margin>0&&wgc<wpc) disp('system is STABLE');


elseif(gain_margin<0&&phase_margin<0&&wgc>wpc)
disp('system is UNSTABLE') ; elseif (wgc==wpc) disp('system is
MARGINALLY STABLE') ; end

system is STABLE

You might also like