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 |
7016
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
3430
|
9 ## |
7016
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
3430
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
3430
|
18 |
|
19 ## -*- texinfo -*- |
3500
|
20 ## @deftypefn {Function File} {} tfout (@var{num}, @var{denom}, @var{x}) |
|
21 ## Print formatted transfer function @math{n(s)/d(s)} to the screen. |
3430
|
22 ## @var{x} defaults to the string @code{"s"} |
5642
|
23 ## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, |
|
24 ## filter, polyderiv, polyinteg, polyout} |
3430
|
25 ## @end deftypefn |
|
26 |
|
27 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
28 ## Created: June 1995 |
|
29 |
|
30 function tfout (num, denom, x) |
|
31 |
5568
|
32 if (nargin < 2 ) | (nargin > 3) | (nargout != 0 ) |
6046
|
33 print_usage (); |
5568
|
34 endif |
3430
|
35 |
5568
|
36 if ( (!isvector(num)) | (!isvector(denom)) ) |
|
37 error("tfout: first two argument must be vectors"); |
|
38 endif |
3430
|
39 |
5568
|
40 if (nargin == 2) |
|
41 x = "s"; |
|
42 elseif( ! ischar(x) ) |
|
43 error("tfout: third argument must be a string"); |
|
44 endif |
3430
|
45 |
5568
|
46 numstring = polyout(num,x); |
|
47 denomstring = polyout(denom,x); |
|
48 len = max(length(numstring),length(denomstring)); |
|
49 if(len > 0) |
|
50 y = strrep(blanks(len)," ","-"); |
|
51 disp(numstring) |
|
52 disp(y) |
|
53 disp(denomstring) |
|
54 else |
|
55 error ("tfout: empty transfer function") |
|
56 end |
3430
|
57 |
|
58 endfunction |