function cloci(G)

% Characteristics Loci plot (complex plane) for multivariable systems.
%
% CLOCI(SYS) draws the characteristic loci of the LTI model SYS in the
% complex plane.

decadi=3;
npunti=1000;

w=logspace(-decadi,decadi,npunti);
fr=freqresp(G,w);
for i=1:length(fr),  
    autov(:,i)=eig(fr(:,:,i)); 
end

clf; hold on; grid on

%%% characteristic loci plot
plot(autov.');
plot(conj(autov.'),'--');
%%%

plot([autov(:,1), autov(:,1)].','o');  %% Marker for w=0 rad/s
plot([autov(:,length(w)/2),autov(:,length(w)/2)].','s'); %%% intermediate marker
plot(-1,0,'r+');  %%% Marker for critical point (-1,0)

%%% To understand if the rotation is clockwise or counterclockwise, 
%%% follow the plot from the circle 'o' to the square 

axis equal
