% ***** MATLAB Code Starts Here %
%NYQUIST_04_MAT
%
fig_size = [232 84 774 624];
% System #1
%
num1a = 2*conv([1 1],[1/2 1]);
den1a = conv([1/0.1 1],conv([1/0.2 1],conv([1/0.3 1],[1/10 1])));
[re1a,im1a] = nyquist(num1a,den1a);
figure(1),clf,subplot(221),plot(re1a,im1a,
'b',re1a,-im1a,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'All open-loop poles and zeros in LHP, K > 0'),...v=axis;nyquist_arrow(re1a,im1a,v);
%
num1b = 2*conv([-1 1],[1/2 1]);
den1b = conv([1/0.1 1],conv([1/0.2 1],conv([1/0.3 1],[1/10 1])));
[re1b,im1b] = nyquist(num1b,den1b);
figure(1),subplot(222),plot(re1b,im1b,
'b',re1b,-im1b,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'1 open-loop zero in RHP, K < 0'),...v=axis;nyquist_arrow(re1b,im1b,v);
%
num1c = 2*conv([1 -1],[1/2 1]);
den1c = conv([1/0.1 1],conv([1/0.2 1],conv([1/0.3 1],[1/10 1])));
[re1c,im1c] = nyquist(num1c,den1c);
figure(1),subplot(223),plot(re1c,im1c,
'b',re1c,-im1c,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'1 open-loop zero in RHP, K > 0'),...v=axis;nyquist_arrow(re1c,im1c,v);
%
num1d = 2*conv([1 1],[1/2 1]);
den1d = conv([-1/0.1 1],conv([1/0.2 1],conv([1/0.3 1],[1/10 1])));
[re1d,im1d] = nyquist(num1d,den1d);
figure(1),subplot(224),plot(re1d,im1d,
'b',re1d,-im1d,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'1 open-loop pole in RHP, K < 0'),...v=axis;nyquist_arrow(re1d,im1d,v);
%
% System #2
%
num2a = 2*conv([1/0.2 1],[1/0.3 1]);
den2a = conv([1/0.1 1],conv([1 1],conv([1/2 1],[1/10 1])));
[re2a,im2a] = nyquist(num2a,den2a);
figure(2),clf,subplot(221),plot(re2a,im2a,
'b',re2a,-im2a,'r--'),plotax,set(gcf,'Position',fig_size),... title('All open-loop poles and zeros in LHP, K > 0'),...v=axis;nyquist_arrow(re2a,im2a,v);
%
num2b = 2*conv([-1/0.2 1],[1/0.3 1]);
den2b = conv([1/0.1 1],conv([1 1],conv([1/2 1],[1/10 1])));
[re2b,im2b] = nyquist(num2b,den2b);
figure(2),subplot(222),plot(re2b,im2b,
'b',re2b,-im2b,'r--'),plotax,set(gcf,'Position',fig_size),... title('1 open-loop zero in RHP, K < 0'),...v=axis;nyquist_arrow(re2b,im2b,v);
%
num2c = 2*conv([1/0.2 -1],[1/0.3 1]);
den2c = conv([1/0.1 1],conv([1 1],conv([1/2 1],[1/10 1])));
[re2c,im2c] = nyquist(num2c,den2c);
figure(2),subplot(223),plot(re2c,im2c,
'b',re2c,-im2c,'r--'),plotax,set(gcf,'Position',fig_size),... title('1 open-loop zero in RHP, K > 0'),...v=axis;nyquist_arrow(re2c,im2c,v);
%
num2d = 2*conv([1/0.2 1],[1/0.3 1]);
den2d = conv([-1/0.1 1],conv([1 1],conv([1/2 1],[1/10 1])));
[re2d,im2d] = nyquist(num2d,den2d);
figure(2),subplot(224),plot(re2d,im2d,
'b',re2d,-im2d,'r--'),plotax,set(gcf,'Position',fig_size),... title('1 open-loop pole in RHP, K < 0'),...v=axis;nyquist_arrow(re2d,im2d,v);
%
% System #3
%
num3a = [1 -2];
den3a = conv([1 -10],conv([1 -20],[1 50]));
[re3a,im3a] = nyquist(1000*num3a,den3a);
figure(3),clf,subplot(221),plot(re3a,im3a,
'b',re3a,-im3a,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'P_0 = 2, K = 1,000'),...v=axis;nyquist_arrow(re3a,im3a,v);
%
[re3b,im3b] = nyquist(3000*num3a,den3a);
figure(3),subplot(222),plot(re3b,im3b,
'b',re3b,-im3b,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'P_0 = 2, K = 3,000'),...v=axis;nyquist_arrow(re3b,im3b,v);
%
[re3c,im3c] = nyquist(9000*num3a,den3a);
figure(3),subplot(223),plot(re3c,im3c,
'b',re3c,-im3c,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'P_0 = 2, K = 9,000'),...v=axis;nyquist_arrow(re3c,im3c,v);
%
[re3d,im3d] = nyquist(-3000*num3a,den3a);
figure(3),subplot(224),plot(re3d,im3d,
'b',re3d,-im3d,'r--'),plotax,set(gcf,'Position',fig_size),...title(
'P_0 = 2, K = -3,000'),...v=axis;nyquist_arrow(re3d,im3d,v);
% % ***** MATLAB Code Stops Here
Click the
icon to return to the Dr. Beale's home page
Lastest revision on Wednesday, November 28, 2007 10:35 PM