7017
|
1 ## Copyright (C) 1996, 2000, 2002, 2003, 2004, 2005, 2006, 2007 |
|
2 ## Auburn University. All rights reserved. |
3430
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
7016
|
7 ## under the terms of the GNU General Public License as published by |
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3430
|
10 ## |
7016
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
3430
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
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 ## |
7007
|
39 ## If no continuous path exists, @var{csys} will be empty. |
3430
|
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 |
5568
|
48 if (nargin != 1) |
6046
|
49 print_usage (); |
7136
|
50 elseif (! isstruct (sys)) |
|
51 error ("sys must be in system data structure form"); |
5568
|
52 endif |
3430
|
53 |
5568
|
54 sys = sysupdate (sys, "ss"); |
|
55 [n_tot, st_c, st_d, y_c, y_d] = __syscont_disc__ (sys); # get ranges |
3430
|
56 |
5568
|
57 ## assume there's nothing there; build partitions as appropriate |
|
58 Acc = Acd = Bcc = Ccc = Ccd = Dcc = []; |
3430
|
59 |
7136
|
60 if (isempty (st_c) && isempty (y_c)) |
|
61 error ("syscont: expecting continuous states and/or continuous outputs"); |
|
62 elseif (isempty (st_c)) |
|
63 warning ("syscont: no continuous states"); |
|
64 elseif (isempty (y_c)) |
|
65 warning ("syscont: no continuous outputs"); |
5568
|
66 endif |
3430
|
67 |
7136
|
68 [sys_a, sys_b, sys_c, sys_d ] = sys2ss (sys); |
|
69 [sys_stname, sys_inname, sys_outname] = sysgetsignals (sys); |
|
70 [sys_n, sys_nz, sys_m, sys_p] = sysdimensions (sys); |
|
71 if (! isempty (st_c)) |
5568
|
72 Acc = sys_a(st_c,st_c); |
|
73 stname = sys_stname(st_c); |
|
74 Bcc = sys_b(st_c,:); |
|
75 Ccc = sys_c(y_c,st_c); |
|
76 Acd = sys_a(st_c,st_d); |
|
77 else |
7136
|
78 stname = []; |
5568
|
79 endif |
|
80 outname = sys_outname(y_c); |
|
81 Dcc = sys_d(y_c,:); |
|
82 Ccd = sys_c(y_c,st_d); |
|
83 inname = sys_inname; |
3430
|
84 |
7136
|
85 csys = ss (Acc, Bcc, Ccc, Dcc, 0, sys_n, 0, stname, inname, outname); |
3430
|
86 |
|
87 endfunction |