From: <par...@us...> - 2012-04-21 13:43:31
|
Revision: 10305 http://octave.svn.sourceforge.net/octave/?rev=10305&view=rev Author: paramaniac Date: 2012-04-21 13:43:25 +0000 (Sat, 21 Apr 2012) Log Message: ----------- control: handle more special cases for filt Modified Paths: -------------- trunk/octave-forge/main/control/inst/filt.m Modified: trunk/octave-forge/main/control/inst/filt.m =================================================================== --- trunk/octave-forge/main/control/inst/filt.m 2012-04-21 13:03:28 UTC (rev 10304) +++ trunk/octave-forge/main/control/inst/filt.m 2012-04-21 13:43:25 UTC (rev 10305) @@ -75,36 +75,50 @@ function sys = filt (num = {}, den = {}, tsam = -1, varargin) - if (! iscell (num)) - num = {num}; - endif - - if (! iscell (den)) - den = {den}; - endif + switch (nargin) + case 0 # filt () + sys = tf (); + return; - ## convert from z^-1 to z - ## expand each channel by z^x, where x is the largest exponent of z^-1 (z^-x) + case 1 # filt (sys), filt (matrix) + if (isa (num, "lti") || is_real_matrix (num)) + sys = tf (num); + return; + else + print_usage (); + endif - ## remove trailing zeros - ## such that polynomials are as short as possible - num = cellfun (@__remove_trailing_zeros__, num, "uniformoutput", false); - den = cellfun (@__remove_trailing_zeros__, den, "uniformoutput", false); + otherwise # filt (num, den, ...) + if (! iscell (num)) + num = {num}; + endif + if (! iscell (den)) + den = {den}; + endif - ## make numerator and denominator polynomials equally long - ## by adding trailing zeros - lnum = cellfun (@length, num, "uniformoutput", false); - lden = cellfun (@length, den, "uniformoutput", false); + ## convert from z^-1 to z + ## expand each channel by z^x, where x is the largest exponent of z^-1 (z^-x) - lmax = cellfun (@max, lnum, lden, "uniformoutput", false); + ## remove trailing zeros + ## such that polynomials are as short as possible + num = cellfun (@__remove_trailing_zeros__, num, "uniformoutput", false); + den = cellfun (@__remove_trailing_zeros__, den, "uniformoutput", false); - num = cellfun (@postpad, num, lmax, "uniformoutput", false); - den = cellfun (@postpad, den, lmax, "uniformoutput", false); + ## make numerator and denominator polynomials equally long + ## by adding trailing zeros + lnum = cellfun (@length, num, "uniformoutput", false); + lden = cellfun (@length, den, "uniformoutput", false); - ## use standard tf constructor - ## sys is stored and displayed in standard z form, not z^-1 - sys = tf (num, den, tsam, varargin{:}); + lmax = cellfun (@max, lnum, lden, "uniformoutput", false); + num = cellfun (@postpad, num, lmax, "uniformoutput", false); + den = cellfun (@postpad, den, lmax, "uniformoutput", false); + + ## use standard tf constructor + ## sys is stored and displayed in standard z form, not z^-1 + sys = tf (num, den, tsam, varargin{:}); + endswitch + endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-06-13 08:28:17
|
Revision: 10628 http://octave.svn.sourceforge.net/octave/?rev=10628&view=rev Author: paramaniac Date: 2012-06-13 08:28:08 +0000 (Wed, 13 Jun 2012) Log Message: ----------- control: fix copy-paste error in docstring Modified Paths: -------------- trunk/octave-forge/main/control/inst/filt.m Modified: trunk/octave-forge/main/control/inst/filt.m =================================================================== --- trunk/octave-forge/main/control/inst/filt.m 2012-06-12 15:09:09 UTC (rev 10627) +++ trunk/octave-forge/main/control/inst/filt.m 2012-06-13 08:28:08 UTC (rev 10628) @@ -37,7 +37,7 @@ ## default value -1 (unspecified) is taken. ## @item @dots{} ## Optional pairs of properties and values. -## Type @command{set (tf)} for more information. +## Type @command{set (filt)} for more information. ## @end table ## ## @strong{Outputs} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |