From: <par...@us...> - 2012-05-07 04:39:48
|
Revision: 10372 http://octave.svn.sourceforge.net/octave/?rev=10372&view=rev Author: paramaniac Date: 2012-05-07 04:39:42 +0000 (Mon, 07 May 2012) Log Message: ----------- control: handle special case num=0 or den=1 when displaying z^-1 Modified Paths: -------------- trunk/octave-forge/main/control/inst/@tf/display.m trunk/octave-forge/main/control/inst/filt.m Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2012-05-07 03:27:54 UTC (rev 10371) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2012-05-07 04:39:42 UTC (rev 10372) @@ -66,9 +66,11 @@ tfp = isa (num, "tfpoly"); - if (tfp && num == 0) + if (num == tfpoly (0)) str = [" ", name, ": 0"]; - elseif (tfp && den == 1) + elseif ((tfp && den == 1) || (! tfp && isequal (den, 1))) + ## elseif (den == tfpoly (1)) doesn't work because it + ## would mistakingly accept non-tfpoly denominators like [0, 1] str = [" ", name, ": "]; numstr = tfpoly2str (num, tfvar); str = [str, numstr]; Modified: trunk/octave-forge/main/control/inst/filt.m =================================================================== --- trunk/octave-forge/main/control/inst/filt.m 2012-05-07 03:27:54 UTC (rev 10371) +++ trunk/octave-forge/main/control/inst/filt.m 2012-05-07 04:39:42 UTC (rev 10372) @@ -78,11 +78,13 @@ switch (nargin) case 0 # filt () sys = tf (); + ## sys.inv = true; return; case 1 # filt (sys), filt (matrix) if (isa (num, "lti") || is_real_matrix (num)) sys = tf (num); + ## sys.inv = true; # would be a problem for continuous-time LTI models return; else print_usage (); @@ -115,7 +117,9 @@ den = cellfun (@postpad, den, lmax, "uniformoutput", false); ## use standard tf constructor - ## sys is stored and displayed in standard z form, not z^-1 + ## sys is stored in standard z form, not z^-1 + ## so we can mix it with regular transfer function models + ## property "inv", true displays sys in z^-1 form sys = tf (num, den, tsam, "inv", true, varargin{:}); endswitch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |