3430
|
1 ## Copyright (C) 1996 Auburn University. All rights reserved. |
|
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 |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301 USA. |
3430
|
19 |
|
20 ## -*- texinfo -*- |
3500
|
21 ## @deftypefn {Function File} {} tfout (@var{num}, @var{denom}, @var{x}) |
|
22 ## Print formatted transfer function @math{n(s)/d(s)} to the screen. |
3430
|
23 ## @var{x} defaults to the string @code{"s"} |
5642
|
24 ## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, |
|
25 ## filter, polyderiv, polyinteg, polyout} |
3430
|
26 ## @end deftypefn |
|
27 |
|
28 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
29 ## Created: June 1995 |
|
30 |
|
31 function tfout (num, denom, x) |
|
32 |
5568
|
33 if (nargin < 2 ) | (nargin > 3) | (nargout != 0 ) |
6046
|
34 print_usage (); |
5568
|
35 endif |
3430
|
36 |
5568
|
37 if ( (!isvector(num)) | (!isvector(denom)) ) |
|
38 error("tfout: first two argument must be vectors"); |
|
39 endif |
3430
|
40 |
5568
|
41 if (nargin == 2) |
|
42 x = "s"; |
|
43 elseif( ! ischar(x) ) |
|
44 error("tfout: third argument must be a string"); |
|
45 endif |
3430
|
46 |
5568
|
47 numstring = polyout(num,x); |
|
48 denomstring = polyout(denom,x); |
|
49 len = max(length(numstring),length(denomstring)); |
|
50 if(len > 0) |
|
51 y = strrep(blanks(len)," ","-"); |
|
52 disp(numstring) |
|
53 disp(y) |
|
54 disp(denomstring) |
|
55 else |
|
56 error ("tfout: empty transfer function") |
|
57 end |
3430
|
58 |
|
59 endfunction |