annotate scripts/control/system/sysrepdemo.m @ 4771:b8105302cfe8

[project @ 2004-02-16 17:45:50 by jwe]
author jwe
date Mon, 16 Feb 2004 17:45:50 +0000
parents 65b3519ac3a1
children 4c8a2e4e0717
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 1996, 1998 Auburn University. All rights reserved.
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
2 ##
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
4 ##
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by the
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
7 ## Free Software Foundation; either version 2, or (at your option) any
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
8 ## later version.
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
9 ##
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
13 ## for more details.
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
14 ##
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
18
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {} sysrepdemo
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
21 ## Tutorial for the use of the system data structure functions.
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
22 ## @end deftypefn
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
23
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
24 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
25 ## Created: June 1995
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
26 ## Revised Aug 1995 for system data structure format
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
27
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
28 function sysrepdemo ()
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
29
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
30 save_val = page_screen_output;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
31 page_screen_output = 1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
32
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
33 disp("System representation demo:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
34 num = [5, -1];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
35 denom = [1, -2, 6];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
36 a = b = c = [];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
37 syschoice = -1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
38 ch_init = 2;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
39 ch_extract = ch_init+1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
40 ch_update = ch_extract+1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
41 ch_view = ch_update+1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
42 ch_details = ch_view+1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
43 ch_quit = ch_details+1;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
44 while(syschoice != ch_quit)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
45 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
46 syschoice = menu("Octave System Representation Menu", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
47 "General overview of system representation (DO THIS FIRST)", ...
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
48 "Initialize a system (ss, tf, zp)", ...
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
49 "Extract data from a system(sys2ss, sys2tf, sys2zp, etc.)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
50 "Update internal representation (sysupdate)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
51 "View the internal contents of a system (sysout)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
52 "Details of internal representation", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
53 "Return to main menu");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
54 if(syschoice == 1) # general overview
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
55 disp("The Octave Control Systems Toolbox (OCST) was designed to")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
56 disp("provide a simple user interface to a powerful set of tools.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
57 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
58 disp(" ----------")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
59 disp(" input(s) ---->| System | ---> output(s) ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
60 disp(" ----------")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
61 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
62 disp("Like other computer-aided control system design tools, the OCST")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
63 disp("enables users to enter their descriptions of dynamic systems in ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
64 disp("their preferred form (state space, transfer function, or ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
65 disp("zero-pole format). ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
66 disp("The OCST stores system descriptions in a single variable data ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
67 disp("structure that allows for continuous time, discrete-time, or mixed ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
68 disp("(sampled-data) systems. ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
69 disp(" ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
70 disp("This single variable description of dynamic systems greatly simplifies ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
71 disp("both the code of the OCST as well as the user interface, since only")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
72 disp("one variable is passed per system, regardless of the internal ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
73 disp("representation used in the data structure. As a result, the ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
74 disp("likelihood of user error is greatly reduced when calling OCST")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
75 disp("functions. Further, all OCST functions have been written to")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
76 disp("provide meaningful warning or error message to assist the user")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
77 disp("in correcting their programming errors while using the OCST.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
78 disp("The details of the internal representation can be seen in ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
79 disp(["menu option ",num2str(ch_details)]);
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
80 disp("The data structure used in the OCST is called a \"system data structure.\"");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
81 disp("A system data structure is contstructed with one of:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
82 disp(" fir (FIR transfer function to system)")
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
83 disp(" ss (state space matrices to system)")
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
84 disp(" tf (SISO transfer function to system)")
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
85 disp(" zp (SISO zero/pole/leading coefficient to system)")
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
86 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
87 disp(["These functions are discussed in in menu option ",num2str(ch_init)])
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
88 disp("The data in a system may be extracted using ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
89 disp(" sys2fir (FIR transfer function from system")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
90 disp(" sys2ss (state space matrices from system)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
91 disp(" sys2tf (SISO transfer function from system)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
92 disp(" sys2zp (SISO zero/pole/leading coefficient from system)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
93 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
94 disp(["These functions are discussed in menu option ", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
95 num2str(ch_extract)]);
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
96 disp("Other options discussed under this menu are updating the internal")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
97 disp("representation form of a system data structure with sysupdate and printing")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
98 disp("the description of a dynamic system to the screen with sysout.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
99 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
100 disp("Once the user is familiar with these commands, the rest of the ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
101 disp("OCST package will be quite easy to use.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
102 elseif(syschoice == ch_init) % Initialize
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
103 disp("Initialization of a system:");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
104 disp(" ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
105 formopt = 0;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
106 while(formopt != 4)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
107 disp("Three data formats may be used to initialize a system:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
108 formopt = menu("System data structure initialization menu", ...
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
109 "State space form (ss)", ...
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
110 "Transfer function form (tf)", ...
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
111 "zero-pole form (zp)", ...
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
112 "Return to System representation menu");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
113 if(formopt == 1)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
114 disp("State space representation of a system is based on the usual")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
115 disp("multi-variable differential equations")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
116 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
117 disp(" . ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
118 disp(" x = A x + B u -or - x(k+1) = A x(k) + B u(k) ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
119 disp(" y = C x + D u y(k) = C x(k) + D u(k) ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
120 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
121 disp("for matrices A, B, C, D of appropriate dimension.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
122 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
123 ssopt = 0;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
124 ssquit = 5;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
125 while(ssopt < ssquit)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
126 ssopt = menu("State space initialization examples", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
127 "Double integrator example", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
128 "Double delay (discrete-time) example", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
129 "Summing junction (D-matrix only) example", ...
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
130 "ss details (help ss)", ...
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
131 "return to system initialization menu", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
132 "return to system representation main menu");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
133 if(ssopt == 1)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
134 disp("Example: construct a system representation of a")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
135 disp("double integrator via state-space form")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
136 cmd = "a = [0, 1; 0, 0];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
137 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
138 cmd = "b = [0; 1];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
139 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
140 cmd = "c = [1, 0];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
141 run_cmd
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
142 cmd = "sys = ss(a,b,c);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
143 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
144 disp("The state space form of the system is seen via sysout:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
145 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
146 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
147 disp("Notice that the Octave controls toolbox automatically")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
148 disp("assigns names to the states, inputs and outputs,")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
149 disp("and that the D matrix was filled in automatically.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
150 disp("We verify that it's a double integrator via sysout:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
151 cmd = "sysout(sys,""tf"")";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
152 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
153 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
154 elseif(ssopt == 2)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
155 disp("Example: discrete-time double-delay:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
156 disp("This example is identical to the double-integrator,")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
157 disp("except that it is a discrete-time system, and so has")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
158 disp("a sampling interval. We arbitrarily select T=1e-3.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
159 cmd = "a = [0, 1; 0, 0];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
160 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
161 cmd = "b = [0; 1];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
162 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
163 cmd = "c = [1, 0];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
164 run_cmd
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
165 cmd = "sys=ss(a,b,c,[],1e-3);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
166 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
167 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
168 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
169 disp("Notice that the D matrix was filled in automatically.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
170 disp("This is done if D is input as the empty matrix.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
171 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
172 disp("Notice also that the output y_1 is labelled as a discrete")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
173 disp("output. The OCST data structure keeps track of states")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
174 disp("and output signals that are produced by the discrete-time")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
175 disp("portion of a system. Discrete states and outputs are ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
176 disp("implemented as shown in the block diagram below:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
177 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
178 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
179 disp(" _________ ________ x(kT) ________________")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
180 disp("f(t)-->|sampler|-->| delay |----->|zero order hold| -->")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
181 disp(" --------- -------- ----------------")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
182 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
183 disp(" ___________ _______________")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
184 disp("f(t)-->| sampler |-->|zero-order hold| --> y(discrete)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
185 disp(" ----------- ---------------")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
186 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
187 disp("where f(t) is an input signal to either the output or the")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
188 disp(" discrete state.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
189 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
190 disp("The OCST does not implement samplers on inputs to continuous")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
191 disp("time states (i.e., there are no samplers implicit in the B")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
192 disp("or D matrices unless there are corresponding discrete")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
193 disp("outputs or states. The OCST provides warning messages when")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
194 disp("if this convention is violated.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
195 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
196 elseif(ssopt == 3)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
197 disp("A summing junction that computes e(t) = r(t) - y(t) may be");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
198 disp("constructed as follows:");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
199 disp("First, we set the matrix D:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
200 cmd = "D = [1, -1];";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
201 run_cmd
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
202 disp("ss allows the initialization of signal and state names")
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
203 disp("(see option 4), so we initialize these as follows:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
204 cmd = "inname = {\"r(t)\",\"y(t)\"};";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
205 run_cmd;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
206 cmd = "outname = \"e(t)\";";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
207 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
208 disp("Since the system is continous time and without states,")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
209 disp("the ss inputs tsam, n, and nz are all zero:")
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
210 cmd = "sys = ss([],[],[],D,0,0,0,[],inname,outname);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
211 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
212 disp("The resulting system is:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
213 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
214 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
215 disp("A discrete-time summing block can be implemented by setting")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
216 disp("the sampling time positive:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
217 cmd = "sys = ss([],[],[],D,1e-3,0,0,[],inname,outname);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
218 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
219 disp("The resulting system is:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
220 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
221 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
222 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
223 elseif(ssopt == 4)
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
224 help ss
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
225 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
226 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
227 disp("Notice that state-space form allows a single system to have")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
228 disp("both continuous and discrete-time states and to have both continuous")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
229 disp("and discrete-time outputs. Since it's fairly easy to make an")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
230 disp("error when mixing systems of this form, the Octave controls")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
231 disp("toolbox attempts to print warning messages whenever something")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
232 disp("questionable occurs.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
233 elseif(ssopt == 6)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
234 formopt = 4; # return to main menu
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
235 endif
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
236 endwhile
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
237 elseif(formopt == 2)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
238 tfopt = 0;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
239 while(tfopt < 5)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
240 tfopt = menu("Transfer function initialization menu", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
241 "Continuous time initialization" , ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
242 "Discrete time initialization" , ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
243 "User specified signal names" , ...
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
244 "tf details (help tf)", ...
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
245 "Return to system initialization menu", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
246 "Return to system representation main menu");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
247 if(tfopt == 1) # continuous time
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
248 disp("A transfer function is represented by vectors of the")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
249 disp("coefficients of the numerator and denominator polynomials");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
250 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
251 disp("For example: the transfer function");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
252 disp(" ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
253 num = [5, -1];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
254 denom = [1, -2, 6];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
255 tfout(num,denom);
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
256 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
257 disp("is generated by the following commands:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
258 cmd = "num = [5, -1]";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
259 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
260 cmd = "denom = [1, -2, 6]";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
261 run_cmd
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
262 cmd = "sys = tf(num,denom);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
263 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
264 disp("alternatively, the system can be generated in a single command:");
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
265 cmd = "sys = tf([5, -1], [1, -2, 6]);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
266 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
267 disp("Notice the output of sys: it is an Octave data structure.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
268 disp("The details of its member variables are explained under")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
269 disp("System Representation Menu option 5 (the details of system form)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
270 disp(" ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
271 disp("The data structure can be observed with the sysout command:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
272 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
273 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
274 disp("Notice that Octave assigns names to inputs and outputs.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
275 disp("The user may manually select input and output names; see option 3");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
276 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
277 elseif(tfopt == 2) # discrete time
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
278 disp("A transfer function is represented by vectors of the")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
279 disp("coefficients of the numerator and denominator polynomials");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
280 disp("Discrete-time transfer functions require ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
281 disp("the additional parameter of a sampling period:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
282 cmd = "sys=tf([5, -1], [1, 2, -6], 1e-3);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
283 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
284 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
285 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
286 disp("The OCST recognizes discrete-time transfer functions and")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
287 disp("accordingly prints them with the frequency domain variable z.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
288 disp("Notice that Octave assigns names to inputs and outputs.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
289 disp("The user may set input and output names; see option 3");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
290 elseif(tfopt == 3) # user specified names
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
291 disp("The OCST requires all signals to have names. The OCST assigned default");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
292 disp("names to the signals in the other examples. We may initialize a transfer");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
293 disp("function with user-specified names as follows: Consider a simple ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
294 disp("double-integrator model of aircraft roll dynamics with ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
295 disp("input \"aileron angle\" and output \"theta\". A ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
296 disp("system for this model is generated by the command")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
297 cmd = "aircraft=tf(1, [1, 0, 0], 0,\"aileron angle\",\"theta\");"; run_cmd
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
298 disp("The sampling time parameter 0 indicates that the system")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
299 disp("is continuous time. A positive sampling time indicates a")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
300 disp("discrete-time system (or sampled data system).")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
301 cmd = "sysout(aircraft)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
302 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
303 disp("Notice that the user-selected signal names are listed.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
304 disp("These signal names are used in OCST plots and design functions.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
305 disp("(Run the frequency response demo to see an example of the use of ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
306 disp("signal names in plots.)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
307 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
308 elseif(tfopt == 4) # help
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
309 help tf
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
310 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
311 elseif(tfopt == 6) # return to main menu
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
312 formopt = 4;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
313 endif
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
314 endwhile
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
315 elseif (formopt == 3)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
316 zpopt = 0;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
317 while(zpopt < 5)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
318 zpopt = menu("Zero-pole initialization menu", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
319 "Continuous time initialization" , ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
320 "Discrete time initialization" , ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
321 "User specified signal names" , ...
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
322 "zp details (help zp)", ...
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
323 "Return to system initialization menu", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
324 "Return to system representation main menu");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
325 if(zpopt == 1) # continuous time
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
326 disp("A zero-pole form representation of a system includes vectors")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
327 disp("of the system poles and zeros and a scalar leading coefficient.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
328 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
329 disp("For example: the transfer function");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
330 disp(" ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
331 k = 5;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
332 num = [5, -1];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
333 denom = [1, -2, 6];
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
334 zpout(num,denom,k);
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
335 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
336 disp("is generated by the following commands:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
337 cmd = "num = [5, -1]";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
338 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
339 cmd = "denom = [1, -2, 6]";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
340 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
341 cmd = "k = 5";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
342 run_cmd
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
343 cmd = "sys = zp(num,denom,k);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
344 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
345 disp("alternatively, the system can be generated in a single command:");
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
346 cmd = "sys = zp([5, -1],[1, -2, 6],5);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
347 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
348 disp("Notice the output of sys: it is an Octave data structure.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
349 disp("The details of its member variables are explained under")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
350 disp("System Representation Menu option 5 (the details of system form)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
351 disp(" ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
352 disp("The data structure can be observed with the sysout command:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
353 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
354 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
355 disp("Notice that Octave assigns names to inputs and outputs.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
356 disp("The user may manually select input and output names; see option 3");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
357 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
358 elseif(zpopt == 2) # discrete time
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
359 disp("A zero-pole form representation of a system includes vectors")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
360 disp("of the system poles and zeros and a scalar leading coefficient.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
361 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
362 disp("Discrete-time systems require the additional parameter of a sampling period:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
363 cmd = "sys=zp([5, -1],[1, 2, -6],5,1e-3);";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
364 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
365 cmd = "sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
366 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
367 disp("The OCST recognizes discrete-time transfer functions and")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
368 disp("accordingly prints them with the frequency domain variable z.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
369 disp("Notice that Octave assigns names to inputs and outputs.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
370 disp("The user may set input and output names; see option 3");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
371 elseif(zpopt == 3) # user specified names
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
372 disp("The OCST requires all signals to have names. The OCST assigned default");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
373 disp("names to the signals in the other examples. We may initialize a transfer");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
374 disp("function with user-specified names as follows: Consider a simple ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
375 disp("double-integrator model of aircraft roll dynamics with ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
376 disp("input \"aileron angle\" and output \"theta\". A ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
377 disp("system for this model is generated by the command")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
378 cmd = "aircraft=zp([],[0, 0],1,0,\"aileron angle\",\"theta\");"; run_cmd
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
379 disp("The sampling time parameter 0 indicates that the system")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
380 disp("is continuous time. A positive sampling time indicates a")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
381 disp("discrete-time system (or sampled data system).")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
382 cmd = "sysout(aircraft)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
383 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
384 disp("Notice that the user-selected signal names are listed.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
385 disp("These signal names are used in OCST plots and design functions.");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
386 disp("(Run the frequency response demo to see an example of the use of ");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
387 disp("signal names in plots.)")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
388 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
389 elseif(zpopt == 4) # help
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
390 help zp
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
391 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
392 elseif(zpopt == 6) # return to main menu
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
393 formopt = 4;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
394 endif
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
395 endwhile
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
396 endif
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
397 endwhile
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
398 elseif(syschoice == ch_extract) # extract system information
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
399 disp("Extract information from a system data structure in a selected format:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
400 disp("The actions of operations ss, tf, and zp are reversed by")
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
401 disp("respective functions sys2ss, sys2tf, and sys2zp. The latter two");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
402 disp("functions are applicable only to SISO systems.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
403 formopt = 0;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
404 while(formopt != 8)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
405 formopt = menu("Extract system information", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
406 "in state space form (sys2ss)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
407 "in transfer function form (sys2tf)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
408 "in zero pole form (sys2zp)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
409 "signal names (sysgetsignals,syssetsignals)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
410 "sampling time (sysgettsam)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
411 "signal dimensions (sysdimensions)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
412 "primary system type (sysgettype)", ...
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
413 "Return to system representation menu");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
414 if(formopt == 1)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
415 help sys2ss
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
416 elseif(formopt == 2)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
417 help sys2tf
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
418 elseif(formopt == 3)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
419 help sys2zp
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
420 elseif(formopt == 4)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
421 help sysgetsignals
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
422 cmd="sys=ss(rand(4),rand(4,2),rand(3,4));";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
423 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
424 printf("Example: All signals names can be extracted by\n");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
425 cmd = "[Ast,Ain,Aout,Ayd] = sysgetsignals(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
426 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
427 printf("Example: Input signal names can be extracted as\n");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
428 cmd = "Ain = sysgetsignals(sys,\"in\")";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
429 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
430 printf("Example: The name of output signal 2 can be extracted as\n");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
431 cmd = "Aout = sysgetsignals(sys,\"out\",2)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
432 run_cmd
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
433 printf("\nNotice that Aout is returned as a cell array; the signal name\n");
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
434 printf("itself is obtained by specifying the input parameter strflg\n");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
435 cmd = "Aout = sysgetsignals(sys,\"out\",2,1)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
436 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
437 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
438 cmd = "help syssetsignals";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
439 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
440 printf("Example: set input 2 name to \"motor voltage\"\n");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
441 cmd = "sys = syssetsignals(sys,\"in\",\"motor voltage\",2); sysout(sys)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
442 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
443
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
444 printf("Other syssetsignals demos are in the Block diagram demo program bddemo\n");
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
445 elseif(formopt == 5)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
446 help sysgettsam
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
447 elseif(formopt == 6)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
448 help sysdimensions
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
449 elseif(formopt == 7)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
450 help sysgettype
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
451 endif
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
452 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
453 endwhile
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
454 elseif(syschoice== ch_update)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
455 disp("The OCST system data structure format will store a system in the same format")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
456 disp("as that with which it was initialized. For example, consider the following:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
457 cmd = "sys=zp([1, 2],[3, 4, 5],6)";
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
458 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
459 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
460 disp("Notice the internal variables in the structure include zer, pol, and k,")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
461 disp("the required variables for zero-pole form. We can update the system")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
462 disp("to include state-space form as follows:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
463 cmd = "sys = sysupdate(sys,\"ss\")";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
464 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
465 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
466 disp("Now the sys data structure includes variables a, b, c, and d, as well")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
467 disp("the default state names stname. sysupdate is usually used internally in")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
468 disp("the OCST, but can be used manually if desired. A full description of")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
469 disp("sysupdate is as follows:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
470 help sysupdate
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
471 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
472 elseif(syschoice == ch_view)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
473 disp("The sysout command can be used to view a system in any desired format.")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
474 disp("For example, consider the system created as follows:")
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3430
diff changeset
475 cmd = "aircraft=zp(1,[0, 0],1,0,\"aileron angle\",\"theta\");"; run_cmd
3430
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
476 disp("The system may be viewed in its default format (zero-pole) as follows")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
477 cmd = "sysout(aircraft)";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
478 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
479 disp(" ")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
480 disp("The system may be viewed in state-space or transfer function form as well:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
481 cmd = "sysout(aircraft,\"ss\")";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
482 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
483 cmd = "sysout(aircraft,\"tf\")";
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
484 run_cmd
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
485 disp("A complete description of sysout is below:")
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
486 help sysout
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
487 prompt
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
488 elseif(syschoice == ch_details)
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
489 packedform
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
490 endif
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
491
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
492 endwhile
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
493 page_screen_output = save_val;
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
494 endfunction
65b3519ac3a1 [project @ 2000-01-14 03:44:03 by jwe]
jwe
parents:
diff changeset
495