changeset 10692:c06d1849fcd3 octave-forge

fir2: always return a row (matlab compatibility)
author carandraug
date Wed, 15 Aug 2012 13:41:35 +0000
parents b765c82a7f34
children 8627cd8b11c0
files main/signal/NEWS main/signal/inst/fir2.m
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/main/signal/NEWS	Wed Aug 15 13:15:12 2012 +0000
+++ b/main/signal/NEWS	Wed Aug 15 13:41:35 2012 +0000
@@ -4,7 +4,10 @@
 signal-1.1.4   Release Date: 2012-XX-XX   Release Manager:
 ===============================================================================
 
- ** Improved Matlab compability for the function `fir2'.
+ ** Improved Matlab compability for the function `fir2'. This changes include
+    always returning vaues in a row (even when the smoothing window is a single
+    column), the default values for grid_n and ramp_n, and returning an error
+    when invalid values are used (instead of silently adjusting them).
 
  ** Fixed failing test for the function `residued'.
 
--- a/main/signal/inst/fir2.m	Wed Aug 15 13:15:12 2012 +0000
+++ b/main/signal/inst/fir2.m	Wed Aug 15 13:41:35 2012 +0000
@@ -129,14 +129,12 @@
     b = ifft([grid ; zeros(grid_n*2,1) ;grid(grid_n:-1:2)]);
     b = 2 * real([ b([end-n+1:2:end]) ; b(2:2:(n+1))]);
   endif
+
   ## Multiplication in the time domain is convolution in frequency,
   ## so multiply by our window now to smooth the frequency response.
-  if rows(window) > 1
-    b = b .* window;
-  else
-    b = b' .* window;
-  endif
-  b = b'
+  ## Also, for matlab compatibility, we return return values in 1 row
+  b = b(:)' .* window(:)';
+
 endfunction
 
 %% Test that the grid size is rounded up to the next power of 2