3213
|
1 # Copyright (C) 1996,1998 A. Scottedward Hodel |
|
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, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
18 |
|
19 function [n,nz,m,p,yd] = sysdimensions(sys) |
|
20 # [n,nz,m,p[,yd]] = sysdimensions(sys) |
|
21 # return the number of states, inputs, and outputs in the system sys. |
|
22 # inputs: sys: system data structure |
|
23 # outputs: |
|
24 # n: number of continuous states |
|
25 # nz: number of discrete states |
|
26 # m: number of system inputs |
|
27 # p: number of system outputs |
|
28 # yd: is the discrete output vector: yd(ii) = 1 if output ii is sampled, |
|
29 # yd(ii) = 0 if output ii is continous |
|
30 # |
|
31 # see also: sysgetsignals, sysgettsam |
|
32 |
|
33 if(nargout > 5 | nargin != 1) |
|
34 usage("[n,nz,m,p[,yd]] = sysdimensions(sys)"); |
|
35 elseif(!is_struct(sys)) |
|
36 usage("[n,nz,m,p] = sysdimensions(sys)"); |
|
37 endif |
|
38 |
|
39 n = sys.n; |
|
40 nz = sys.nz; |
|
41 m = rows(sys.inname); |
|
42 p = rows(sys.outname); |
|
43 yd = sys.yd; |
|
44 |
|
45 endfunction |