]> Creatis software - CreaPhase.git/blob - octave_packages/control-2.3.52/@lti/ssdata.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / control-2.3.52 / @lti / ssdata.m
1 ## Copyright (C) 2009, 2010, 2011   Lukas F. Reichlin
2 ##
3 ## This file is part of LTI Syncope.
4 ##
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.
9 ##
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.
14 ##
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/>.
17
18 ## -*- texinfo -*-
19 ## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}, @var{tsam}] =} ssdata (@var{sys})
20 ## Access state-space model data.
21 ## Argument @var{sys} is not limited to state-space models.
22 ## If @var{sys} is not a state-space model, it is converted automatically.
23 ##
24 ## @strong{Inputs}
25 ## @table @var
26 ## @item sys
27 ## Any type of LTI model.
28 ## @end table
29 ##
30 ## @strong{Outputs}
31 ## @table @var
32 ## @item a
33 ## State transition matrix (n-by-n).
34 ## @item b
35 ## Input matrix (n-by-m).
36 ## @item c
37 ## Measurement matrix (p-by-n).
38 ## @item d
39 ## Feedthrough matrix (p-by-m).
40 ## @item tsam
41 ## Sampling time in seconds.  If @var{sys} is a continuous-time model,
42 ## a zero is returned.
43 ## @end table
44 ## @end deftypefn
45
46 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
47 ## Created: September 2009
48 ## Version: 0.4
49
50 function [a, b, c, d, tsam, scaled] = ssdata (sys)
51
52   if (! isa (sys, "ss"))
53     sys = ss (sys);
54   endif
55
56   [a, b, c, d, e, ~, scaled] = __sys_data__ (sys);
57
58   [a, b, c, d, e] = __dss2ss__ (a, b, c, d, e);
59
60   tsam = sys.tsam;
61
62 endfunction