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 ## |
|
23 ## @strong{Inputs} |
|
24 ## @var{sys} is a system data structure |
|
25 ## |
|
26 ## @strong{Outputs} |
|
27 ## @table @var |
|
28 ## @item csys |
|
29 ## is the purely continuous input/output connections of @var{sys} |
3502
|
30 ## @item acd |
|
31 ## @itemx ccd |
3430
|
32 ## connections from discrete states to continuous states, |
|
33 ## discrete states to continuous outputs, respectively. |
|
34 ## |
|
35 ## returns @var{csys} empty if no continuous/continous path exists |
|
36 ## @end table |
|
37 ## @end deftypefn |
|
38 |
|
39 ## Author: John Ingram <ingraje@eng.auburn.edu> |
|
40 ## Created: August 1996 |
|
41 |
|
42 function [csys, Acd, Ccd] = syscont (sys) |
|
43 |
|
44 save_empty = empty_list_elements_ok; |
|
45 empty_list_elements_ok = 1; |
|
46 |
|
47 if (nargin != 1) |
|
48 usage("[csys,Acd,Ccd,Dcd] = syscont(sys)"); |
|
49 elseif (!is_struct(sys)) |
|
50 error("sys must be in system data structure form"); |
|
51 endif |
|
52 |
3438
|
53 sys = sysupdate (sys, "ss"); |
|
54 [n_tot, st_c, st_d, y_c, y_d] = __syscont_disc__ (sys); # get ranges |
3430
|
55 |
|
56 ## assume there's nothing there; build partitions as appropriate |
|
57 Acc = Acd = Bcc = Ccc = Ccd = Dcc = []; |
|
58 |
|
59 if(isempty(st_c) & isempty(y_c)) |
|
60 error("syscont: expecting continous states and/or continous outputs"); |
|
61 elseif (isempty(st_c)) |
|
62 warning("syscont: no continuous states"); |
|
63 elseif(isempty(y_c)) |
|
64 warning("syscont: no continuous outputs"); |
|
65 endif |
|
66 |
|
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; |
|
83 |
|
84 csys = ss2sys(Acc,Bcc,Ccc,Dcc,0,sys_n,0,stname,inname,outname); |
|
85 |
|
86 empty_list_elements_ok = save_empty; |
|
87 |
|
88 endfunction |