merle has asked for the wisdom of the Perl Monks concerning the following question:

good morning monks, i´ve got a lil issue here, i was hoping you could help me with. i´ve got an array with numbers (40-300) now i want to make a FFT(Fast Fourier Transformation)with the array to then find the key points with the highest magnitude from certain ranges 40-80, 80-120, 120-180, 180-300. I dont come further than that:
use strict; use warnings; use Math::FFT; my $series[0] = 123; my $series[1] = 260; my $series[2] = 46; my $series[3] = 94; # ... etc ... my $fft = new Math::FFT(@series);
Does any one know how to get on this, i cant figure it out. Thanks in advance! * Merle

Replies are listed 'Best First'.
Re: finding highest magnitude - FFT
by toolic (Bishop) on Dec 08, 2013 at 03:58 UTC
    It looks like you are passing the wrong type of data to new. According to the Math::FFT POD, you should pass a reference to an array, not a single scalar as you are doing.
Re: finding highest magnitude - FFT
by Laurent_R (Canon) on Dec 08, 2013 at 08:50 UTC
    Try something like this:
    my $series = [ qw { 123 49 43 90 ...} ]; my $fft = new Math::FFT($series);
Re: finding highest magnitude - FFT
by merle (Initiate) on Dec 08, 2013 at 11:52 UTC
    Ok, thank you it works with an array! But there's still the problem to find the highest magnitude points in certain ranges... Does anybody knows how to get on this?

      Walk thru the range (array), marking (assigning) each element to highest ($high) unless the element is less than $high. Then print/save/whatever $high.

      This, of course, ignores the possibility of ties.