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