Mercurial > octave-nkf
comparison scripts/control/base/frdemo.m @ 4771:b8105302cfe8
[project @ 2004-02-16 17:45:50 by jwe]
author | jwe |
---|---|
date | Mon, 16 Feb 2004 17:45:50 +0000 |
parents | 2e06c3941943 |
children | bdbee5282954 |
comparison
equal
deleted
inserted
replaced
4770:ef5e598f099b | 4771:b8105302cfe8 |
---|---|
55 disp(" ") | 55 disp(" ") |
56 clc | 56 clc |
57 disp("\nContinuous system bode analysis\n"); | 57 disp("\nContinuous system bode analysis\n"); |
58 disp("Example #1:") | 58 disp("Example #1:") |
59 disp("\nConsider the system sys1="); | 59 disp("\nConsider the system sys1="); |
60 sys1=tf2sys([1, 1], [1, 0, -1]); | 60 sys1=tf([1, 1], [1, 0, -1]); |
61 sysout(sys1); | 61 sysout(sys1); |
62 disp("\nPole-zero form can be obtained as follows:") | 62 disp("\nPole-zero form can be obtained as follows:") |
63 cmd = "sysout(sys1,""zp"");"; | 63 cmd = "sysout(sys1,""zp"");"; |
64 run_cmd; | 64 run_cmd; |
65 disp("The systems bode plot is obtained as follows:"); | 65 disp("The systems bode plot is obtained as follows:"); |
85 prompt; | 85 prompt; |
86 | 86 |
87 disp("") | 87 disp("") |
88 clc | 88 clc |
89 disp("Example #2, sys2=") | 89 disp("Example #2, sys2=") |
90 cmd = "sys2=zp2sys(1, [-1, -5], 10);"; | 90 cmd = "sys2=zp(1, [-1, -5], 10);"; |
91 eval(cmd); | 91 eval(cmd); |
92 cmd = "sysout(sys2);"; | 92 cmd = "sysout(sys2);"; |
93 eval(cmd); | 93 eval(cmd); |
94 disp("\nThe bode plot command is identical to the tf form:") | 94 disp("\nThe bode plot command is identical to the tf form:") |
95 cmd = "bode(sys2);"; | 95 cmd = "bode(sys2);"; |
99 prompt; | 99 prompt; |
100 | 100 |
101 disp("") | 101 disp("") |
102 clc | 102 clc |
103 disp("Example #3, Consider the following state space system sys3=:\n"); | 103 disp("Example #3, Consider the following state space system sys3=:\n"); |
104 cmd = "sys3=ss2sys([0, 1; -1000, -1001], [0; 1], [0, -891], 1);"; | 104 cmd = "sys3=ss([0, 1; -1000, -1001], [0; 1], [0, -891], 1);"; |
105 eval(cmd); | 105 eval(cmd); |
106 cmd = "sysout(sys3);"; | 106 cmd = "sysout(sys3);"; |
107 eval(cmd); | 107 eval(cmd); |
108 disp("\nOnce again, the bode plot command is the same:"); | 108 disp("\nOnce again, the bode plot command is the same:"); |
109 cmd = "bode(sys3);"; | 109 cmd = "bode(sys3);"; |
173 clc | 173 clc |
174 disp("\nDiscrete system bode analysis\n"); | 174 disp("\nDiscrete system bode analysis\n"); |
175 disp("Display bode plots of a discrete SISO system (dbode)\n") | 175 disp("Display bode plots of a discrete SISO system (dbode)\n") |
176 disp("Example #1, Consider the following discrete transfer"); | 176 disp("Example #1, Consider the following discrete transfer"); |
177 disp(" function:\n"); | 177 disp(" function:\n"); |
178 cmd = "sys1 = tf2sys([0.00100502, -0.00099502], [1, -2, 1], 0.001);"; | 178 cmd = "sys1 = tf([0.00100502, -0.00099502], [1, -2, 1], 0.001);"; |
179 disp(cmd); | 179 disp(cmd); |
180 eval(cmd); | 180 eval(cmd); |
181 cmd = "sysout(sys1)"; | 181 cmd = "sysout(sys1)"; |
182 disp(cmd); | 182 disp(cmd); |
183 eval(cmd); | 183 eval(cmd); |
212 prompt | 212 prompt |
213 disp("") | 213 disp("") |
214 clc | 214 clc |
215 disp("Example #2, Consider the following set of discrete poles and"); | 215 disp("Example #2, Consider the following set of discrete poles and"); |
216 disp("zeros:\n") | 216 disp("zeros:\n") |
217 cmd = "sys2 = zp2sys([0.99258;0.99745],[0.99961;0.99242],1,0.001);"; | 217 cmd = "sys2 = zp([0.99258;0.99745],[0.99961;0.99242],1,0.001);"; |
218 disp(cmd); | 218 disp(cmd); |
219 eval(cmd); | 219 eval(cmd); |
220 cmd = "sysout(sys2)"; | 220 cmd = "sysout(sys2)"; |
221 disp(cmd); | 221 disp(cmd); |
222 eval(cmd); | 222 eval(cmd); |
230 | 230 |
231 prompt | 231 prompt |
232 disp("") | 232 disp("") |
233 clc | 233 clc |
234 disp("\nExample #3, Now consider the following state space system:\n"); | 234 disp("\nExample #3, Now consider the following state space system:\n"); |
235 cmd = "sys3 = ss2sys([.857, .0011; 0, .99930],[1;1],[-.6318, .0057096],5.2, .001);"; | 235 cmd = "sys3 = ss([.857, .0011; 0, .99930],[1;1],[-.6318, .0057096],5.2, .001);"; |
236 disp(cmd); | 236 disp(cmd); |
237 eval(cmd); | 237 eval(cmd); |
238 cmd = "sysout(sys3);"; | 238 cmd = "sysout(sys3);"; |
239 disp(cmd); | 239 disp(cmd); |
240 eval(cmd); | 240 eval(cmd); |
321 disp("") | 321 disp("") |
322 clc | 322 clc |
323 disp("\nContinuous system nyquist analysis\n"); | 323 disp("\nContinuous system nyquist analysis\n"); |
324 disp("Display Nyquist plots of a SISO system (nyquist)\n") | 324 disp("Display Nyquist plots of a SISO system (nyquist)\n") |
325 disp("Example #1, Consider the following transfer function:\n") | 325 disp("Example #1, Consider the following transfer function:\n") |
326 cmd = "sys1 = tf2sys(1, [1, 0.8, 1]);"; | 326 cmd = "sys1 = tf(1, [1, 0.8, 1]);"; |
327 disp(cmd); | 327 disp(cmd); |
328 eval(cmd); | 328 eval(cmd); |
329 disp("To examine the transfer function, use the command:"); | 329 disp("To examine the transfer function, use the command:"); |
330 cmd = "sysout(sys1);"; | 330 cmd = "sysout(sys1);"; |
331 disp(cmd); | 331 disp(cmd); |
358 prompt | 358 prompt |
359 | 359 |
360 disp("") | 360 disp("") |
361 clc | 361 clc |
362 disp("Example #2, Consider the following set of poles and zeros:\n") | 362 disp("Example #2, Consider the following set of poles and zeros:\n") |
363 cmd = "sys2 = zp2sys([-1;-4],[-2+1.4142i;-2-1.4142i],1);"; | 363 cmd = "sys2 = zp([-1;-4],[-2+1.4142i;-2-1.4142i],1);"; |
364 disp(cmd); | 364 disp(cmd); |
365 eval(cmd); | 365 eval(cmd); |
366 disp("\nTo examine the poles and zeros, use the command:"); | 366 disp("\nTo examine the poles and zeros, use the command:"); |
367 cmd = "sysout(sys2)"; | 367 cmd = "sysout(sys2)"; |
368 disp(cmd); | 368 disp(cmd); |
374 prompt | 374 prompt |
375 | 375 |
376 disp("") | 376 disp("") |
377 clc | 377 clc |
378 disp("\nExample #3, Consider the following state space system:\n") | 378 disp("\nExample #3, Consider the following state space system:\n") |
379 cmd = "sys3 = ss2sys([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 0, -20, -12],[0;0;0;1],[50, 100, 0, 0],0);"; | 379 cmd = "sys3 = ss([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 0, -20, -12],[0;0;0;1],[50, 100, 0, 0],0);"; |
380 disp(cmd); | 380 disp(cmd); |
381 eval(cmd); | 381 eval(cmd); |
382 disp("\nTo examine the state-space system, use the command:"); | 382 disp("\nTo examine the state-space system, use the command:"); |
383 cmd = "sysout(sys3)"; | 383 cmd = "sysout(sys3)"; |
384 disp(cmd); | 384 disp(cmd); |
447 disp("We will first define a sampling time, T"); | 447 disp("We will first define a sampling time, T"); |
448 cmd = "T = 0.01;"; | 448 cmd = "T = 0.01;"; |
449 disp(cmd); | 449 disp(cmd); |
450 eval(cmd); | 450 eval(cmd); |
451 disp("\nExample #1, Consider the following transfer function:\n") | 451 disp("\nExample #1, Consider the following transfer function:\n") |
452 cmd = "sys1 = tf2sys([2, -3.4, 1.5],[1, -1.6, 0.8],T);"; | 452 cmd = "sys1 = tf([2, -3.4, 1.5],[1, -1.6, 0.8],T);"; |
453 disp(cmd); | 453 disp(cmd); |
454 eval(cmd); | 454 eval(cmd); |
455 disp("To examine the transfer function, use the command:"); | 455 disp("To examine the transfer function, use the command:"); |
456 cmd = "sysout(sys1);"; | 456 cmd = "sysout(sys1);"; |
457 disp(cmd); | 457 disp(cmd); |
489 prompt | 489 prompt |
490 | 490 |
491 disp("") | 491 disp("") |
492 clc | 492 clc |
493 disp("\nExample #2, Consider the following set of poles and zeros:\n") | 493 disp("\nExample #2, Consider the following set of poles and zeros:\n") |
494 cmd = "sys2 = zp2sys([0.98025 + 0.01397i; 0.98025 - 0.01397i],[0.96079;0.99005],1,T);"; | 494 cmd = "sys2 = zp([0.98025 + 0.01397i; 0.98025 - 0.01397i],[0.96079;0.99005],1,T);"; |
495 disp(cmd); | 495 disp(cmd); |
496 eval(cmd); | 496 eval(cmd); |
497 disp("\nTo examine the open loop zeros and poles, use the command:"); | 497 disp("\nTo examine the open loop zeros and poles, use the command:"); |
498 cmd = "sysout(sys2)"; | 498 cmd = "sysout(sys2)"; |
499 disp(cmd); | 499 disp(cmd); |
512 disp("\nExample #3, Consider the following discrete state space"); | 512 disp("\nExample #3, Consider the following discrete state space"); |
513 disp("system:\n"); | 513 disp("system:\n"); |
514 disp("This example will use the same system used in the third"); | 514 disp("This example will use the same system used in the third"); |
515 disp("example in the continuous nyquist demo. First, that system"); | 515 disp("example in the continuous nyquist demo. First, that system"); |
516 disp("will have to be re-entered useing the following commands:\n"); | 516 disp("will have to be re-entered useing the following commands:\n"); |
517 cmd = "sys3 = ss2sys([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 0, -20, -12],[0;0;0;1],[50, 100, 0, 0],0);"; | 517 cmd = "sys3 = ss([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 0, 0, -20, -12],[0;0;0;1],[50, 100, 0, 0],0);"; |
518 disp(cmd); | 518 disp(cmd); |
519 eval(cmd); | 519 eval(cmd); |
520 disp("\nTo examine the state-space system, use the command:"); | 520 disp("\nTo examine the state-space system, use the command:"); |
521 cmd = "sysout(sys3)"; | 521 cmd = "sysout(sys3)"; |
522 disp(cmd); | 522 disp(cmd); |