You are on page 1of 1

CODE:

function y = Assignment2(zeta,p,z)
tf2 = tf(zpk(z,p,1)); %creating transfer function from
pole,zeros,K=1
tf1=tf(tf2)
rlocus(tf1)
axis equal

for r = 1:0.05:10 %trying different values for radius


z1 = r*exp(1i*(pi-acos(zeta)));
thetaPOLE = 0;
thetaZERO = 0;
for i = 1:length(p) %calculating sum of poles
thetaPOLE = thetaPOLE + rad2deg(angle(z1-p(i)));

end
for i = 1:length(z) %calculating sum of zeros
thetaZERO = thetaZERO + rad2deg(angle(z1-z(i)));
end
final = thetaZERO - thetaPOLE;
if round(final,0) == 180 || round(final,0) == -180 %if
its an odd multiple of 180, it lies on the root locus
% e = r;
break
end
end
K = r
point = z1;
ang=rad2deg(angle(point))

You might also like