%% branches of a root loci clear all; gain =1; zeros = -8; poles = [-2+2*j, -2-2*j, -12]'; L = zpk(zeros,poles,gain); Ks = cat(1,logspace(-1,2,100)',logspace(2,4,100)'); [R] = rlocus(L,Ks); figure plot(real(poles(1)),imag(poles(1)),'bx',real(poles(2)),imag(poles(2)),'kx',real(poles(3)),imag(poles(3)),'rx'); hold on; plot(real(zeros),imag(zeros),'bo'); th = title('open loop poles and zeros'); set(th,'fontsize',20); axis([-13 2 -40 40]); %polt the real and imag axis: plot([-13 2],[0 0],':'); plot([0 0],[-40 40],':'); %plot the asymptotes: relative_degree = length(poles) - length(zeros); alpha = (sum(poles) - sum(zeros))/relative_degree; rs = [0.1:0.1: 100]'; for ell=1:relative_degree phi_ell = pi/relative_degree + 2*pi/relative_degree *(ell-1); line_ell = rs*[cos(phi_ell), sin(phi_ell)] + repmat([alpha 0],length(rs),1) ; ph(ell) = plot(line_ell(:,1), line_ell(:,2),'b:') end; pause(3); for ii=1:length(R) roots = R(:,ii)+ 1e-16*j; plot(real(roots(1)), imag(roots(1)),'bx',real(roots(2)), imag(roots(2)),'kx',real(roots(3)), imag(roots(3)),'rx'); titlestr = ['K = ',num2str(Ks(ii))]; set(th,'string',titlestr); pause(0.01); end;