Mercurial > hg > octave-lyh
diff scripts/polynomial/deconv.m @ 10740:6cc789b3f0e3
scripts/polynomial/deconv.m: ensure that the orientation of the third input to 'filter' matches the orientation of 'y'.
author | Soren Hauberg <hauberg@gmail.com> |
---|---|
date | Sun, 04 Jul 2010 12:38:40 +0200 |
parents | d1978e7364ad |
children | fd0a3ac60b0e |
line wrap: on
line diff
--- a/scripts/polynomial/deconv.m +++ b/scripts/polynomial/deconv.m @@ -55,7 +55,9 @@ endif if (ly > la) - b = filter (y, a, [1, (zeros (1, ly - la))]); + x = zeros (size (y) - size (a) + 1); + x (1) = 1; + b = filter (y, a, x); elseif (ly == la) b = filter (y, a, 1); else @@ -100,6 +102,9 @@ %! [b, r] = deconv ([3; 6], [1, 2, 3]); %! assert (b == 0 && all (all (r == [3; 6]))) +%!test +%! assert (deconv ((1:3)',[1, 1]), [1; 1]) + %!error [b, r] = deconv ([3, 6], [1, 2; 3, 4]); %!error [b, r] = deconv ([3, 6; 1, 2], [1, 2, 3]);