1 ## Copyright (C) 2009, 2010 Lukas F. Reichlin
3 ## This file is part of LTI Syncope.
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
19 ## Number of outputs (p), inputs (m) and states (n) of state space matrices.
20 ## For internal use only.
22 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
23 ## Created: September 2009
26 function [p, m, n] = __ss_dim__ (a, b, c, d, e = [])
28 ## TODO: create oct-file?
30 if (! is_real_matrix (a, b, c, d, e))
31 error ("ss: system matrices must be real");
34 [arows, acols] = size (a);
35 [brows, bcols] = size (b);
36 [crows, ccols] = size (c);
37 [drows, dcols] = size (d);
44 error ("ss: system matrix a(%dx%d) is not square", arows, acols);
48 error ("ss: system matrices a(%dx%d) and b(%dx%d) are incompatible",
49 arows, acols, brows, bcols);
53 error ("ss: system matrices a(%dx%d) and c(%dx%d) are incompatible",
54 arows, acols, crows, ccols);
58 error ("ss: system matrices b(%dx%d) and d(%dx%d) are incompatible",
59 brows, bcols, drows, dcols);
63 error ("ss: system matrices c(%dx%d) and d(%dx%d) are incompatible",
64 crows, ccols, drows, dcols);
67 if (! isempty (e) && ! size_equal (e, a))
68 error ("ss: system matrices a(%dx%d) and e(%dx%d) are incompatible",
69 arows, acols, rows (e), columns (e));