# HG changeset patch # User jwe # Date 782097258 0 # Node ID 15ee4d50d9ddcee6a60fe3e86cb20469416d70c9 # Parent 1844c17634f957b4a7786d80a957dfc9fe3534f0 [project @ 1994-10-14 01:14:18 by jwe] diff --git a/scripts/signal/filter.m b/scripts/signal/filter.m --- a/scripts/signal/filter.m +++ b/scripts/signal/filter.m @@ -44,6 +44,8 @@ # amr@mpl.ucsd.edu # June 1994 +# Bug fix by FL (Friedrich.Leisch@ci.tuwien.ac.at) on Oct 12, 1994 + if(nargin < 3 || nargin > 4) error("usage: [y, sf] = filter(b,a,x[,si])"); endif @@ -59,12 +61,15 @@ MN = max([N M]); lw = MN - 1; + # It's convenient to pad the coefficient vectors to the same length. + b = postpad(b,MN); + # Ensure that all vectors have the assumed dimension. if(columns(a) > 1) a = reshape(a,N,1); endif if(columns(b) > 1) - b = reshape(b,M,1); + b = reshape(b,MN,1); endif if(nargin == 3) @@ -82,9 +87,6 @@ # Allocate space for result. y = zeros(1,L); - # It's convenient to pad the coefficient vectors to the same length. - b = postpad(b,MN); - norm = a(1); if (norm == 0.) error("First element in second argument must be non-zero.");