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 |
|
17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
|
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 ## |
|
38 ## returns @var{csys} empty if no continuous/continous path exists |
|
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 |
4460
|
47 save_warn_empty_list_elements = warn_empty_list_elements; |
|
48 unwind_protect |
|
49 warn_empty_list_elements = 0; |
3430
|
50 |
4460
|
51 if (nargin != 1) |
|
52 usage("[csys,Acd,Ccd,Dcd] = syscont(sys)"); |
|
53 elseif (!isstruct(sys)) |
|
54 error("sys must be in system data structure form"); |
|
55 endif |
3430
|
56 |
4460
|
57 sys = sysupdate (sys, "ss"); |
|
58 [n_tot, st_c, st_d, y_c, y_d] = __syscont_disc__ (sys); # get ranges |
3430
|
59 |
4460
|
60 ## assume there's nothing there; build partitions as appropriate |
|
61 Acc = Acd = Bcc = Ccc = Ccd = Dcc = []; |
3430
|
62 |
4460
|
63 if(isempty(st_c) & isempty(y_c)) |
|
64 error("syscont: expecting continous states and/or continous outputs"); |
|
65 elseif (isempty(st_c)) |
|
66 warning("syscont: no continuous states"); |
|
67 elseif(isempty(y_c)) |
|
68 warning("syscont: no continuous outputs"); |
|
69 endif |
3430
|
70 |
4460
|
71 [sys_a, sys_b, sys_c, sys_d ] = sys2ss(sys); |
|
72 [sys_stname, sys_inname, sys_outname] = sysgetsignals(sys); |
|
73 [sys_n, sys_nz, sys_m, sys_p] = sysdimensions(sys); |
|
74 if(!isempty(st_c)) |
|
75 Acc = sys_a(st_c,st_c); |
|
76 stname = sys_stname(st_c); |
|
77 Bcc = sys_b(st_c,:); |
|
78 Ccc = sys_c(y_c,st_c); |
|
79 Acd = sys_a(st_c,st_d); |
|
80 else |
|
81 stname=[]; |
|
82 endif |
|
83 outname = sys_outname(y_c); |
|
84 Dcc = sys_d(y_c,:); |
|
85 Ccd = sys_c(y_c,st_d); |
|
86 inname = sys_inname; |
3430
|
87 |
4771
|
88 csys = ss(Acc,Bcc,Ccc,Dcc,0,sys_n,0,stname,inname,outname); |
3430
|
89 |
4460
|
90 unwind_protect_cleanup |
|
91 warn_empty_list_elements = save_warn_empty_list_elements; |
|
92 end_unwind_protect |
3430
|
93 |
|
94 endfunction |