changeset 5986:14078139f941

[project @ 2006-09-12 02:46:33 by jwe]
author jwe
date Tue, 12 Sep 2006 02:46:33 +0000
parents 5f662c1cfbbe
children f1375e3f3b97
files scripts/ChangeLog scripts/signal/freqz.m
diffstat 2 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,12 @@
+2006-09-11  Paul Kienzle  <pkienzle@users.sf.net>
+
+	* signal/freqz.m: Update tests.
+
+2006-09-11  Ken Kouno  <kouno@mk.ecei.tohoku.ac.jp>
+
+	* signal/freqz.m: Corretly postpad arrays.
+	Don't call fliplr on a column vector.
+
 2006-09-11  Luis F. Ortiz  <lortiz@interactivesupercomputing.com>
 
 	* general/shiftdim.m: Use permute instead of reshape.
--- a/scripts/signal/freqz.m
+++ b/scripts/signal/freqz.m
@@ -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);