# HG changeset patch # User jwe # Date 1158029193 0 # Node ID 14078139f94114bec9993fd7963f3039a315bd93 # Parent 5f662c1cfbbe7c2e28d1c3fdbbe1d2b446e27634 [project @ 2006-09-12 02:46:33 by jwe] diff -r 5f662c1cfbbe -r 14078139f941 scripts/ChangeLog --- a/scripts/ChangeLog Tue Sep 12 02:41:46 2006 +0000 +++ b/scripts/ChangeLog Tue Sep 12 02:46:33 2006 +0000 @@ -1,3 +1,12 @@ +2006-09-11 Paul Kienzle + + * signal/freqz.m: Update tests. + +2006-09-11 Ken Kouno + + * signal/freqz.m: Corretly postpad arrays. + Don't call fliplr on a column vector. + 2006-09-11 Luis F. Ortiz * general/shiftdim.m: Use permute instead of reshape. diff -r 5f662c1cfbbe -r 14078139f941 scripts/signal/freqz.m --- a/scripts/signal/freqz.m Tue Sep 12 02:41:46 2006 +0000 +++ b/scripts/signal/freqz.m Tue Sep 12 02:46:33 2006 +0000 @@ -122,8 +122,9 @@ if (nargin == 4) ## Sampling rate Fs was specified w = 2*pi*f/Fs; endif - hb = polyval (fliplr(b), exp(j*w)); - ha = polyval (fliplr(a), exp(j*w)); + k = max (length (b), length (a)); + hb = polyval (postpad (b, k), exp (j*w)); + ha = polyval (postpad (a, k), exp (j*w)); elseif (strcmp (region, "whole")) f = Fs * (0:n-1)' / n; ## polyval(fliplr(P),exp(jw)) is O(p n) and fft(x) is O(n log(n)), @@ -168,11 +169,11 @@ %! assert(w(1:16),w2,20*eps); %!test # Sampling frequency properly interpreted -%! b = [1 1 1]/3; -%! [h,f] = freqz(b,1,16,320); +%! b = [1 1 1]/3; a = [1 0.2]; +%! [h,f] = freqz(b,a,16,320); %! assert(f,[0:15]'*10,10*eps); -%! [h2,f2] = freqz(b,1,[0:15]*10,320); +%! [h2,f2] = freqz(b,a,[0:15]*10,320); %! assert(f2,[0:15]*10,10*eps); -%! assert(h,h2',20*eps); -%! [h3,f3] = freqz(b,1,32,'whole',320); +%! assert(h,h2.',20*eps); +%! [h3,f3] = freqz(b,a,32,'whole',320); %! assert(f3,[0:31]'*10,10*eps);