From: <par...@us...> - 2012-04-21 11:46:43
|
Revision: 10303 http://octave.svn.sourceforge.net/octave/?rev=10303&view=rev Author: paramaniac Date: 2012-04-21 11:46:37 +0000 (Sat, 21 Apr 2012) Log Message: ----------- control: work on filt Modified Paths: -------------- trunk/octave-forge/main/control/devel/filt.m Modified: trunk/octave-forge/main/control/devel/filt.m =================================================================== --- trunk/octave-forge/main/control/devel/filt.m 2012-04-21 11:01:28 UTC (rev 10302) +++ trunk/octave-forge/main/control/devel/filt.m 2012-04-21 11:46:37 UTC (rev 10303) @@ -1,5 +1,17 @@ -function sys = filt (num = {}, den = {}, tsam = -1) +function sys = filt (num = {}, den = {}, tsam = -1, varargin) + if (! iscell (num)) + num = {num}; + endif + + if (! iscell (den)) + den = {den}; + endif + + ## shall i remove trailing zeros before postpadding? + num = cellfun (@__remove_trailing_zeros__, num, "uniformoutput", false); + den = cellfun (@__remove_trailing_zeros__, den, "uniformoutput", false); + lnum = cellfun (@length, num, "uniformoutput", false); lden = cellfun (@length, den, "uniformoutput", false); @@ -8,6 +20,19 @@ num = cellfun (@postpad, num, lmax, "uniformoutput", false); den = cellfun (@postpad, den, lmax, "uniformoutput", false); - sys = tf (num, den, tsam); + sys = tf (num, den, tsam, varargin{:}); +endfunction + + +function p = __remove_trailing_zeros__ (p) + + idx = find (p != 0); + + if (isempty (idx)) + p = 0; + else + p = p(1 : idx(end)); + endif + endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |