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