Hello all,
Here is a patch to the welchwin.m function in the signal package. The
version in the current svn has an error that leads to asymmetric
windows. This patch fixes the problem.
I also noticed that some of the window functions have a division by 0
and return NaN when generating a window of length 1. Examples are
blackmannuttall, blackmanharris, and barthannwin.
Does anyone have an opinion about modifying the functions to always
return a valid number for a window length greater than 0?
At the same time I could put in checks to verify that the window length
is an integer.
Mike
Index: main/signal/inst/welchwin.m
===================================================================
--- main/signal/inst/welchwin.m (revision 5506)
+++ main/signal/inst/welchwin.m (working copy)
@@ -16,7 +16,7 @@
## -*- texinfo -*-
## @deftypefn {Function File} {...@var{w}] =} welchwin(@var{L})
## Compute the Welch window, given by
-## w(n) = 1 - ((n-L/2)/(L/2))^2, n=0,1, ... L-1
+## w(n) = 1 - ((n-(L-1)/2)/((L-1)/2))^2, n=0,1, ... L-1
## @seealso{blackman, kaiser}
## @end deftypefn
@@ -26,8 +26,8 @@
error("L must be a number");
endif
- N = L/2;
- n= 0:L-1;
+ N = (L-1)/2;
+ n = 0:L-1;
w = 1 - ((n-N)./N).^2;
endfunction;
------------------------------------------------------------------------------
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev