7017
|
1 ## Copyright (C) 1996, 2000, 2002, 2004, 2005, 2006, 2007 |
|
2 ## Auburn University. All rights reserved. |
3430
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
7016
|
7 ## under the terms of the GNU General Public License as published by |
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3430
|
10 ## |
7016
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
3430
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
3430
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {[@var{num}, @var{den}, @var{tsam}, @var{inname}, @var{outname}] =} sys2tf (@var{sys}) |
5016
|
22 ## Extract transfer function data from a system data structure. |
3430
|
23 ## |
5016
|
24 ## See @command{tf} for parameter descriptions. |
3430
|
25 ## |
|
26 ## @strong{Example} |
|
27 ## @example |
4771
|
28 ## octave:1> sys=ss([1 -2; -1.1,-2.1],[0;1],[1 1]); |
3430
|
29 ## octave:2> [num,den] = sys2tf(sys) |
|
30 ## num = 1.0000 -3.0000 |
|
31 ## den = 1.0000 1.1000 -4.3000 |
|
32 ## @end example |
|
33 ## @end deftypefn |
|
34 |
|
35 ## Author: R. Bruce Tenison <btenison@eng.auburn.edu> |
|
36 ## Created: June 24, 1994 |
|
37 ## modified to make sys2tf by A. S. Hodel Aug 1995 |
|
38 ## modified again for updated system format by John Ingram July 1996 |
|
39 |
|
40 function [num, den, tsam, inname, outname] = sys2tf (Asys) |
|
41 |
|
42 if(nargin != 1) |
6046
|
43 print_usage (); |
3430
|
44 endif |
|
45 |
4030
|
46 if( !isstruct(Asys)) |
4771
|
47 error("Asys must be a system data structure (see ss, tf, zp)"); |
3430
|
48 elseif (! is_siso(Asys) ) |
|
49 [n, nz, m, p] = sysdimensions(Asys); |
|
50 error(["system is not SISO (",num2str(m)," inputs, ... |
|
51 ", num2str(p)," outputs"]); |
|
52 endif |
|
53 |
|
54 Asys = sysupdate(Asys,"tf"); # just in case |
|
55 |
|
56 num = Asys.num; |
|
57 den = Asys.den; |
|
58 |
|
59 tsam = sysgettsam(Asys); |
|
60 inname = sysgetsignals(Asys,"in"); |
|
61 outname = sysgetsignals(Asys,"out"); |
|
62 |
|
63 endfunction |
|
64 |