3430
|
1 ## Copyright (C) 1996 Auburn University. All rights reserved. |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
7016
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
3430
|
9 ## |
7016
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
3430
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
3430
|
18 |
|
19 ## -*- texinfo -*- |
3502
|
20 ## @deftypefn {Function File} {[@var{csys}, @var{acd}, @var{ccd}] =} syscont (@var{sys}) |
3430
|
21 ## Extract the purely continuous subsystem of an input system. |
|
22 ## |
5016
|
23 ## @strong{Input} |
|
24 ## @table @var |
|
25 ## @item sys |
|
26 ## system data structure. |
|
27 ## @end table |
3430
|
28 ## |
|
29 ## @strong{Outputs} |
|
30 ## @table @var |
|
31 ## @item csys |
|
32 ## is the purely continuous input/output connections of @var{sys} |
3502
|
33 ## @item acd |
|
34 ## @itemx ccd |
3430
|
35 ## connections from discrete states to continuous states, |
|
36 ## discrete states to continuous outputs, respectively. |
|
37 ## |
7007
|
38 ## If no continuous path exists, @var{csys} will be empty. |
3430
|
39 ## @end table |
|
40 ## @end deftypefn |
|
41 |
|
42 ## Author: John Ingram <ingraje@eng.auburn.edu> |
|
43 ## Created: August 1996 |
|
44 |
|
45 function [csys, Acd, Ccd] = syscont (sys) |
|
46 |
5568
|
47 if (nargin != 1) |
6046
|
48 print_usage (); |
5568
|
49 elseif (!isstruct(sys)) |
|
50 error("sys must be in system data structure form"); |
|
51 endif |
3430
|
52 |
5568
|
53 sys = sysupdate (sys, "ss"); |
|
54 [n_tot, st_c, st_d, y_c, y_d] = __syscont_disc__ (sys); # get ranges |
3430
|
55 |
5568
|
56 ## assume there's nothing there; build partitions as appropriate |
|
57 Acc = Acd = Bcc = Ccc = Ccd = Dcc = []; |
3430
|
58 |
5568
|
59 if(isempty(st_c) & isempty(y_c)) |
7001
|
60 error("syscont: expecting continuous states and/or continuous outputs"); |
5568
|
61 elseif (isempty(st_c)) |
|
62 warning("syscont: no continuous states"); |
|
63 elseif(isempty(y_c)) |
|
64 warning("syscont: no continuous outputs"); |
|
65 endif |
3430
|
66 |
5568
|
67 [sys_a, sys_b, sys_c, sys_d ] = sys2ss(sys); |
|
68 [sys_stname, sys_inname, sys_outname] = sysgetsignals(sys); |
|
69 [sys_n, sys_nz, sys_m, sys_p] = sysdimensions(sys); |
|
70 if(!isempty(st_c)) |
|
71 Acc = sys_a(st_c,st_c); |
|
72 stname = sys_stname(st_c); |
|
73 Bcc = sys_b(st_c,:); |
|
74 Ccc = sys_c(y_c,st_c); |
|
75 Acd = sys_a(st_c,st_d); |
|
76 else |
|
77 stname=[]; |
|
78 endif |
|
79 outname = sys_outname(y_c); |
|
80 Dcc = sys_d(y_c,:); |
|
81 Ccd = sys_c(y_c,st_d); |
|
82 inname = sys_inname; |
3430
|
83 |
5568
|
84 csys = ss(Acc,Bcc,Ccc,Dcc,0,sys_n,0,stname,inname,outname); |
3430
|
85 |
|
86 endfunction |