comparison scripts/control/system/tfout.m @ 3430:65b3519ac3a1

[project @ 2000-01-14 03:44:03 by jwe]
author jwe
date Fri, 14 Jan 2000 03:50:02 +0000
parents
children 7923abdeb4e5
comparison
equal deleted inserted replaced
3429:b9f5829ec843 3430:65b3519ac3a1
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 -*-
20 ## @deftypefn {Function File} {} tfout (@var{num}, @var{denom}@{, @var{x}@})
21 ## Print formatted transfer function @math{n(s)/d(s) } to the screen.
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
32 save_empty = empty_list_elements_ok;
33 empty_list_elements_ok = 1;
34
35 if (nargin < 2 ) | (nargin > 3) | (nargout != 0 )
36 usage("tfout(num,denom[,x])");
37 endif
38
39 if ( (!is_vector(num)) | (!is_vector(denom)) )
40 error("tfout: first two argument must be vectors");
41 endif
42
43 if (nargin == 2)
44 x = "s";
45 elseif( ! isstr(x) )
46 error("tfout: third argument must be a string");
47 endif
48
49 numstring = polyout(num,x);
50 denomstring = polyout(denom,x);
51 len = max(length(numstring),length(denomstring));
52 if(len > 0)
53 y = strrep(blanks(len)," ","-");
54 disp(numstring)
55 disp(y)
56 disp(denomstring)
57 else
58 error ("tfout: empty transfer function")
59 end
60
61 empty_list_elements_ok = save_empty;
62 endfunction