comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Inverse FFT
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Inverse FFT [message #33358 is a reply to message #33280] Wed, 18 December 2002 01:19 Go to previous messageGo to previous message
aultc is currently offline  aultc
Messages: 4
Registered: December 2002
Junior Member
Hi Bob,

Fantastic! Thank you very much for your comments and examples - the
manual calculation of the IFT is now working as it should. Also,
thanks for your comments on the time comparison, it is definitely more
desirable to use the FFT(/inv) method, rather than "by hand". However,
I think in some of the things I want to do I will need the manual
method.

Thanks once again for your help,

Colin






"R.G. Stockwell" <sorry@noemail.now> wrote in message news:<3DFF3CA1.7010206@noemail.now>...
> Here is an (main level) example that hopefully does what you want.
> Note the slightly better precision of the fft method, due to the superior
> method of calculating the same thing. Also, there is a huge difference
> in speed, especially as N gets larger than say 10 or so.
> On my computer 1.6Ghz athlon, the times are about a factor of 20.
> (i.e. fft 20 times faster than "by hand").
> The point I am getting to is "don't inverse fft by hand".
>
>
> And note that I left the resulting
> arrays as complex, but it is equal to the original time series, since the
> imaginary part is zero. You may want to cast them to float (or double)
>
> Cheers,
> bob stockwell
>
>
>
> ; make a time series
> len = 16
> a = randomn(seed,len)
> a = double(a)
>
> ; calc spectrum
> ft = fft(a)
>
> ; inverse by fft FAST!
> tic = systime(1)
> ift = fft(ft,/inverse)
> toc = systime(1)
> print,'fft time = ', (toc - tic)*1000d ; microseconds
>
> ; inverse by hand SLOW!
> tic = systime(1)
> byhand = dcomplexarr(len)
> t = dindgen(len)
> for i = 0,len-1 do begin
> byhand = byhand + ft[i]*exp(complex(0,1)*2*!dpi*t*i/len)
> endfor
> toc = systime(1)
> print,'by hand time = ', (toc - tic)*1000d
>
> ; print out results
> print,'original time series'
> print,a
> print,'inverse by fft'
> print,ift
> print,'inverse by hand'
> print,byhand
>
> ; plot out results
> !p.multi = [ 0,1,3]
> plot,a,tit='timeseries'
> plot,ift,tit='by fft'
> oplot,imaginary(ift),linestyle=2
> plot,byhand,tit='byhand'
> oplot,imaginary(byhand),linestyle=2
> end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What I Want for Christmas.
Next Topic: Re: IDLDE refresh in Windows XP (IDL 5.2.1)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 07:50:55 PDT 2025

Total time taken to generate the page: 2.63941 seconds