3213
|
1 # Copyright (C) 1996 A. Scottedward Hodel |
|
2 # |
|
3 # This file is part of Octave. |
|
4 # |
|
5 # Octave is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License as published by the |
|
7 # Free Software Foundation; either version 2, or (at your option) any |
|
8 # later version. |
|
9 # |
|
10 # Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License |
|
16 # along with Octave; see the file COPYING. If not, write to the Free |
|
17 # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
18 |
|
19 function [num,den,tsam,inname,outname] = sys2tf(Asys) |
|
20 # function [num,den,tsam,inname,outname] = sys2tf(Asys) |
|
21 # Conversion from a system data structure format to a transfer function. The |
|
22 # transfer function part of ASYS is returned to the user in the form: |
|
23 # |
|
24 # num(s) |
|
25 # G(s)=------- |
|
26 # den(s) |
|
27 # |
|
28 # The user can also have the sampling time (TSAM), the name of the input |
|
29 # (INNAME), and the output name (OUTNAME) |
|
30 |
|
31 # Written by R. Bruce Tenison (June 24, 1994) btenison@eng.auburn.edu |
|
32 # modified to make sys2tf by A. S. Hodel Aug 1995 |
|
33 # modified again for updated system format by John Ingram July 1996 |
3228
|
34 # $Revision: 2.0.0.0 $ |
3213
|
35 |
|
36 if(nargin != 1) |
|
37 usage("[num,den,tsam,inname,outname] = sys2tf(Asys)"); |
|
38 endif |
|
39 |
|
40 if( !is_struct(Asys)) |
|
41 error("Asys must be a system data structure (see ss2sys, tf2sys, zp2sys)"); |
|
42 elseif (! is_siso(Asys) ) |
|
43 [n, nz, m, p] = sysdimensions(Asys); |
|
44 error(["system is not SISO (",num2str(m)," inputs, ... |
|
45 ", num2str(p)," outputs"]); |
|
46 endif |
|
47 |
|
48 Asys = sysupdate(Asys,"tf"); # just in case |
|
49 |
|
50 num = Asys.num; |
|
51 den = Asys.den; |
|
52 |
3228
|
53 tsam = sysgettsam(Asys); |
|
54 inname = sysgetsignals(Asys,"in"); |
|
55 outname = sysgetsignals(Asys,"out"); |
3213
|
56 |
|
57 endfunction |
|
58 |