Skip Menu |

This queue is for tickets about the Math-FFT CPAN distribution.

Report information
The Basics
Id: 44253
Status: open
Priority: 0/
Queue: Math-FFT

People
Owner: Nobody in particular
Requestors: ao_zed [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.28
Fixed in: (no value)



Subject: Hamming window incorrect. Also add Blackman.
Hamming window defined incorrectly. Instead of (1 - cos(2*$pi*$j/$n))/2; it should be (0.54 - 0.46*cos(2*$pi*$j/$n)); # see matlab Also, blackman window should be added. --------------------- Fixes: 'hamm' => sub { my ($j, $n) = @_; my $pi = 4.0*atan2(1,1); return (0.54 - 0.46*cos(2*$pi*$j/$n)); }, ... 'blackman' => sub { my ($j, $n) = @_; my $pi = 4.0*atan2(1,1); return (0.42 - 0.5*cos(2*$pi*$j/$n) + 0.08*cos(4*$pi*$j/$n))/1; }, --------------------- % perl -v This is perl, v5.8.8 built for i386-linux-thread-multi Math::FFT v1.28
On Tue Mar 17 14:41:20 2009, adriano wrote: Show quoted text
> > Hamming window defined incorrectly. > Instead of (1 - cos(2*$pi*$j/$n))/2; > it should be (0.54 - 0.46*cos(2*$pi*$j/$n)); # see matlab > > Also, blackman window should be added. > > > > --------------------- > Fixes: > 'hamm' => sub { > my ($j, $n) = @_; > my $pi = 4.0*atan2(1,1); > return (0.54 - 0.46*cos(2*$pi*$j/$n)); > }, > ... > 'blackman' => sub { > my ($j, $n) = @_; > my $pi = 4.0*atan2(1,1); > return (0.42 - 0.5*cos(2*$pi*$j/$n) + 0.08*cos(4*$pi*$j/$n))/1; > }, >
For backward compatibility, you should assign a new name to the hamming window instead of overriding the existing one. Furthermore, there should be added automated tests. Can you provide a pull request to https://github.com/shlomif/perl-Math-FFT for this? Regards, -- Shlomi Fish