]> Creatis software - CreaPhase.git/blob - octave_packages/signal-1.1.3/tf2ss.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / signal-1.1.3 / tf2ss.m
1 ## Copyright (C) 1994-1996, 1998, 2000, 2002, 2004, 2005, 2007 Auburn University
2 ## Copyright (C) 2012 Lukas F. Reichlin <lukas.reichlin@gmail.com>
3 ##
4 ## This program is free software; you can redistribute it and/or modify it under
5 ## the terms of the GNU General Public License as published by the Free Software
6 ## Foundation; either version 3 of the License, or (at your option) any later
7 ## version.
8 ##
9 ## This program is distributed in the hope that it will be useful, but WITHOUT
10 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 ## details.
13 ##
14 ## You should have received a copy of the GNU General Public License along with
15 ## this program; if not, see <http://www.gnu.org/licenses/>.
16
17 ## -*- texinfo -*-
18 ## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}] =} tf2ss (@var{num}, @var{den})
19 ## Conversion from transfer function to state-space.
20 ## The state space system:
21 ## @iftex
22 ## @tex
23 ## $$ \dot x = Ax + Bu $$
24 ## $$ y = Cx + Du $$
25 ## @end tex
26 ## @end iftex
27 ## @ifinfo
28 ## @example
29 ##       .
30 ##       x = Ax + Bu
31 ##       y = Cx + Du
32 ## @end example
33 ## @end ifinfo
34 ## is obtained from a transfer function:
35 ## @iftex
36 ## @tex
37 ## $$ G(s) = { { \rm num }(s) \over { \rm den }(s) } $$
38 ## @end tex
39 ## @end iftex
40 ## @ifinfo
41 ## @example
42 ##                 num(s)
43 ##           G(s)=-------
44 ##                 den(s)
45 ## @end example
46 ## @end ifinfo
47 ##
48 ## The state space system matrices obtained from this function 
49 ## will be in observable companion form as Wolovich's Observable
50 ## Structure Theorem is used.
51 ## @end deftypefn
52
53 ## Author: R. Bruce Tenison <btenison@eng.auburn.edu>
54
55 function [a, b, c, d, e] = tf2ss (varargin)
56
57   if (nargin == 0)
58     print_usage ();
59   endif
60
61   [a, b, c, d, e] = dssdata (tf (varargin{:}), []);
62
63 endfunction