Mercurial > hg > octave-terminal
changeset 3387:eb4223985ca8
[project @ 1999-12-16 00:38:16 by jwe]
author | jwe |
---|---|
date | Thu, 16 Dec 1999 00:38:17 +0000 |
parents | a5288b88446f |
children | 42cb61dd0248 |
files | scripts/ChangeLog scripts/control/rldemo.m scripts/control/rlocus.m scripts/control/zp2tf.m |
diffstat | 4 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -7,6 +7,7 @@ * control/frdemo.m: Ditto. * control/sysrepdemo.m: Ditto. * control/moddemo.m: Ditto. + * control/zp2tf.m: Ditto. * control/dezero.m: Use toascii to convert string to ASCII value instead of multiplying it by 1.
--- a/scripts/control/rldemo.m +++ b/scripts/control/rldemo.m @@ -42,7 +42,7 @@ clc disp("Display continuous system's open loop poles and zeros (pzmap)\n"); disp("Example #1, Consider the following continuous transfer function:"); - cmd = "sys1 = tf2sys([1.5 18.5 6],[1 4 155 302 5050]);"; + cmd = "sys1 = tf2sys([1.5, 18.5, 6], [1, 4, 155, 302, 5050]);"; disp(cmd); eval(cmd); cmd ="sysout(sys1);"; @@ -59,7 +59,7 @@ clc disp("Example #2, Consider the following set of poles and zeros:"); - cmd = "sys2 = zp2sys([-1 5 -23],[-1 -10 -7+5i -7-5i],5);"; + cmd = "sys2 = zp2sys([-1, 5, -23],[-1, -10, -7+5i, -7-5i],5);"; disp(cmd); eval(cmd); cmd = "sysout(sys2);"; @@ -74,7 +74,7 @@ clc disp("Example #3, Consider the following state space system:\n"); - cmd = "sys3=ss2sys([0 1; -10 -11], [0;1], [0 -2], 1);"; + cmd = "sys3=ss2sys([0, 1; -10, -11], [0; 1], [0, -2], 1);"; disp(cmd); eval(cmd); cmd = "sysout(sys3);"; @@ -103,7 +103,7 @@ cmd = "Tsam = 1;"; run_cmd; disp("Example #1, Consider the following discrete transfer function:"); - cmd = "sys1 = tf2sys([1.05 -0.09048],[1 -2 1],Tsam);"; + cmd = "sys1 = tf2sys([1.05, -0.09048], [1, -2, 1],Tsam);"; disp(cmd); eval(cmd); cmd ="sysout(sys1);"; @@ -120,7 +120,7 @@ clc disp("Example #2, Consider the following set of discrete poles and zeros:"); - cmd = "sys2 = zp2sys([-0.717],[1 -0.368],3.68,Tsam);"; + cmd = "sys2 = zp2sys(-0.717, [1, -0.368], 3.68, Tsam);"; disp(cmd); eval(cmd); cmd = "sysout(sys2);"; @@ -135,7 +135,7 @@ clc disp("Example #3, Consider the following discrete state space system:\n"); - cmd = "sys3=ss2sys([1 0.0952;0 0.905], [0.00484; 0.0952], [1 0], 0, Tsam);"; + cmd = "sys3=ss2sys([1, 0.0952; 0, 0.905], [0.00484; 0.0952], [1, 0], 0, Tsam);"; disp(cmd); eval(cmd); cmd = "sysout(sys3);"; @@ -161,7 +161,7 @@ clc disp("Display root locus of a continuous SISO system (rlocus)\n") disp("Example #1, Consider the following continuous transfer function:"); - cmd = "sys1 = tf2sys([1.5 18.5 6],[1 4 155 302 5050]);"; + cmd = "sys1 = tf2sys([1.5, 18.5, 6],[1, 4, 155, 302, 5050]);"; disp(cmd); eval(cmd); cmd ="sysout(sys1);"; @@ -184,7 +184,7 @@ clc disp("Example #2, Consider the following set of poles and zeros:"); - cmd = "sys2 = zp2sys([],[0 -20 -2 -0.1],5);"; + cmd = "sys2 = zp2sys([],[0, -20, -2, -0.1],5);"; disp(cmd); eval(cmd); cmd = "sysout(sys2);"; @@ -199,7 +199,7 @@ clc disp("Example #3, Consider the following state space system:\n"); - cmd = "sys3=ss2sys([0 1; -10 -11], [0;1], [0 -2], 0);"; + cmd = "sys3=ss2sys([0, 1; -10, -11], [0; 1], [0, -2], 0);"; disp(cmd); eval(cmd); cmd = "sysout(sys3);"; @@ -231,7 +231,7 @@ cmd = "Tsam = 1;"; run_cmd; disp("Example #1, Consider the following discrete transfer function:"); - cmd = "sys1 = tf2sys([1.05 -0.09048],[1 -2 1],Tsam);"; + cmd = "sys1 = tf2sys([1.05, -0.09048],[1, -2, 1],Tsam);"; disp(cmd); eval(cmd); cmd ="sysout(sys1);"; @@ -254,7 +254,7 @@ clc disp("Example #2, Consider the following set of discrete poles and zeros:"); - cmd = "sys2 = zp2sys([-0.717],[1 -0.368],3.68,Tsam);"; + cmd = "sys2 = zp2sys(-0.717, [1, -0.368], 3.68, Tsam);"; disp(cmd); eval(cmd); cmd = "sysout(sys2);"; @@ -271,7 +271,7 @@ clc disp("Example #3, Consider the following discrete state space system:\n"); - cmd = "sys3=ss2sys([1 0.0952;0 0.905], [0.00484; 0.0952], [1 0], 0, Tsam);"; + cmd = "sys3=ss2sys([1, 0.0952; 0, 0.905], [0.00484; 0.0952], [1, 0], 0, Tsam);"; disp(cmd); eval(cmd); cmd = "sysout(sys3);";
--- a/scripts/control/rlocus.m +++ b/scripts/control/rlocus.m @@ -51,7 +51,7 @@ usage("rlocus(sys[,inc,mink,maxk])"); endif - [num,den] = sys2tf(sys); # extract numerator/denom polyomials + [num,den] = sys2tf(sys) # extract numerator/denom polyomials lnum = length(num); lden = length(den); if(lden < 2) error(sprintf("length of derivative=%d, doesn't make sense",lden));
--- a/scripts/control/zp2tf.m +++ b/scripts/control/zp2tf.m @@ -58,14 +58,14 @@ while(!isempty(zer)) if( max(abs(imag(zer))) ) [poly,zer] = zp2ssg2(zer); - else poly = [1 -zer(1)]; + else poly = [1, -zer(1)]; zer = zer(2:length(zer)); endif num = conv(num,poly); endwhile while(!isempty(pol)) if( max(abs(imag(pol))) ) [poly,pol] = zp2ssg2(pol); - else poly = [1 -pol(1)]; + else poly = [1, -pol(1)]; pol = pol(2:length(pol)); endif den = conv(den,poly); endwhile