% congctrl_nyquist.m - Nyquist plots for congestion control system
% RMM, 4 Jul 07

aminit;					% book macors
congctrl_params;			% default parameters

[weq, beq] = congctrl_equil(N, rho, c);
tau = N * weq/c
peq = rho * beq
qeq = N * peq

Gbw = tf([N *weq], [tau, 1]);
Gwq = tf([-N], [qeq * tau, qeq^2 weq]);
Gpb = rho;
del = tf([1], [1]); del.InputDelay = tau;

L = -Gbw * Gwq * del * Gpb;

figure(1); clf;  xsubplot(221); 
amaxis([-0.7 0.9 -0.8 0.8]); daspect(daspect);
hold on; amnyquist(L);
amaxis([-0.7 0.9 -0.8 0.8]); daspect(daspect);

plot(-0.5, 0, 'k+', 'MarkerSize', AM_bode_markersize, ...
  'LineWidth', AM_tick_linewidth);
amtext(-0.6, -0.1, '-0.5');

amprint('congctrl-nyquist.eps');
