SDSU Logo

Main Content

stabreg
%
% Plotting some stability Regions...
%
clear i
N = 512;
for th=0:(2*pi/(N-1)):(2*pi)
  if( th == 0 )
    r1 = roots([1 1-exp(i*th)]);
    r2 = roots([1/2 1 1-exp(i*th)]);
    r3 = roots([1/6 1/2 1 1-exp(i*th)]);
    r4 = roots([1/24 1/6 1/2 1 1-exp(i*th)]);
    r5 = roots([1/120 1/24 1/6 1/2 1 1-exp(i*th)]);
    r6 = roots([1/720 1/120 1/24 1/6 1/2 1 1-exp(i*th)]);
    r7 = roots([1/5040 1/720 1/120 1/24 1/6 1/2 1 1-exp(i*th)]);
    r8 = roots([1/40320 1/5040 1/720 1/120 1/24 1/6 1/2 1 1-exp(i*th)]);
  else
    r1 = [r1; roots([1 1-exp(i*th)])];
    r2 = [r2; roots([1/2 1 1-exp(i*th)])];
    r3 = [r3; roots([1/6 1/2 1 1-exp(i*th)])];
    r4 = [r4; roots([1/24 1/6 1/2 1 1-exp(i*th)])];
    r5 = [r5; roots([1/120 1/24 1/6 1/2 1 1-exp(i*th)])];
    r6 = [r6; roots([1/720 1/120 1/24 1/6 1/2 1 1-exp(i*th)])];
    r7 = [r7; roots([1/5040 1/720 1/120 1/24 1/6 1/2 1 1-exp(i*th)])];
    r8 = [r8; roots([1/40320 1/5040 1/720 1/120 1/24 1/6 1/2 1 1-exp(i*th)])];
  end
end

if( exist('SORT_BY_ANGLE') )
  v=angle(r1); [s,ix]=sort(v); r1=r1(ix);
  v=angle(r2); [s,ix]=sort(v); r2=r2(ix);
  v=angle(r3); [s,ix]=sort(v); r3=r3(ix);
  v=angle(r4); [s,ix]=sort(v); r4=r4(ix);
  v=angle(r5); [s,ix]=sort(v); r5=r5(ix);
  v=angle(r6); [s,ix]=sort(v); r6=r6(ix);
  v=angle(r7); [s,ix]=sort(v); r7=r7(ix);
  v=angle(r8); [s,ix]=sort(v); r8=r8(ix);
end

ms = 4;
plot( real(r1), imag(r1), 'b.', 'markersize', ms );
hold on
plot( real(r2), imag(r2), 'g.', 'markersize', ms );
plot( real(r3), imag(r3), 'r.', 'markersize', ms );
plot( real(r4), imag(r4), 'c.', 'markersize', ms );
plot( real(r5), imag(r5), 'm.', 'markersize', ms );
plot( real(r6), imag(r6), 'y.', 'markersize', ms );
plot( real(r7), imag(r7), 'k.', 'markersize', ms );
plot( real(r8), imag(r8), 'b.', 'markersize', ms );
hold off
axis('equal')
grid on