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 |
|
17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
|
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"} |
|
23 ## @end deftypefn |
|
24 ## @seealso{polyval, polyvalm, poly, roots, conv, deconv, residue, |
|
25 ## filter, polyderiv, polyinteg, and polyout} |
|
26 |
|
27 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
28 ## Created: June 1995 |
|
29 |
|
30 function tfout (num, denom, x) |
|
31 |
4460
|
32 save_warn_empty_list_elements = warn_empty_list_elements; |
|
33 unwind_protect |
|
34 warn_empty_list_elements = 0; |
3430
|
35 |
4460
|
36 if (nargin < 2 ) | (nargin > 3) | (nargout != 0 ) |
|
37 usage("tfout(num,denom[,x])"); |
|
38 endif |
3430
|
39 |
4460
|
40 if ( (!isvector(num)) | (!isvector(denom)) ) |
|
41 error("tfout: first two argument must be vectors"); |
|
42 endif |
3430
|
43 |
4460
|
44 if (nargin == 2) |
|
45 x = "s"; |
|
46 elseif( ! isstr(x) ) |
|
47 error("tfout: third argument must be a string"); |
|
48 endif |
3430
|
49 |
4460
|
50 numstring = polyout(num,x); |
|
51 denomstring = polyout(denom,x); |
|
52 len = max(length(numstring),length(denomstring)); |
|
53 if(len > 0) |
|
54 y = strrep(blanks(len)," ","-"); |
|
55 disp(numstring) |
|
56 disp(y) |
|
57 disp(denomstring) |
|
58 else |
|
59 error ("tfout: empty transfer function") |
|
60 end |
|
61 unwind_protect_cleanup |
|
62 warn_empty_list_elements = save_warn_empty_list_elements; |
|
63 end_unwind_protect |
3430
|
64 |
|
65 endfunction |