1 ## Copyright (C) 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 ## @deftypefn {Function File} {@var{sys} =} dss (@var{sys})
20 ## @deftypefnx {Function File} {@var{sys} =} dss (@var{d})
21 ## @deftypefnx {Function File} {@var{sys} =} dss (@var{a}, @var{b}, @var{c}, @var{d}, @var{e}, @dots{})
22 ## @deftypefnx {Function File} {@var{sys} =} dss (@var{a}, @var{b}, @var{c}, @var{d}, @var{e}, @var{tsam}, @dots{})
23 ## Create or convert to descriptor state-space model.
28 ## LTI model to be converted to state-space.
30 ## State transition matrix (n-by-n).
32 ## Input matrix (n-by-m).
34 ## Measurement matrix (p-by-n).
36 ## Feedthrough matrix (p-by-m).
38 ## Descriptor matrix (n-by-n).
40 ## Sampling time in seconds. If @var{tsam} is not specified,
41 ## a continuous-time model is assumed.
43 ## Optional pairs of properties and values.
44 ## Type @command{set (dss)} for more information.
50 ## Descriptor state-space model.
65 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
66 ## Created: September 2010
69 function sys = dss (varargin)
72 case {0, 1} # static gain (dss (5)) or empty (useful for "set (dss)")
73 sys = ss (varargin{:});
78 otherwise # general case
79 sys = ss (varargin{[1:4, 6:end]}, "e", varargin{5});
84 ## NOTE: The author prefers "dss (e, a, b, c, d)" since we write
86 ## E x = A x + B u, y = C x + D u
88 ## but this would break compatibility to a widespread
89 ## commercial implementation of the octave language.
90 ## There's no way to tell e and d apart if n = m = p.