comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: FFT wierdness in WAVE

Re: FFT wierdness in WAVE
type: item
description: In article <4jbl6k$2dp@news.tamu.edu> howie@skeefum.tamu.edu (Matt Howard) writes: > Subject: FFT wierdness in WAVE > Can anyone here enlighten me on why the plots produced with the > following commands are so different? [Text deleted] >> plot,abs(fft(findgen(8395),-1)) - works! >> plot,abs(fft(findgen(8396),-1)) - fails! Peaks where none should be. A couple of versions ago, the IDL bug-fix notes mentioned a problem with FFT's when the length was not factorable into small primes. For example, of the two numbers in your example, the "fails" case does not factor well: IDL> print,prime_factors(8396) 2 2 2099 but the "works" case does (relatively speaking). IDL> print,prime_factors(8395) 5 23 73 (Note that this is also the reason why the first case takes much longer to compute.) Since PV-Wave got their source from IDL quite a while ago, it seems likely that you're seeing the same problems. You can either hope that it gets fixed in the next version, or switch to IDL :) Brian Jackel University of Western Ontario
creator: Jackel
date: 1996-03-28T08:00:00-00:00

Re: FFT wierdness in WAVE
type: item
description: It's me again :-) howie@skeefum.tamu.edu (Matt Howard) wrote: > Any ideas? yet another one: ;----------------------------------------------------------- ----------- ;weird_fft_2.pro start line ;----------------------------------------------------------- ----------- pro weird_fft_2 tek_color out_old=0 for k=0, 10 do begin if k eq 0 then plot_io ,abs(fft(findgen(2.^10.),-1)), $ xrange=[100,2.^10. ], $ color=1, /nodata ggg=strcompress(string(2^k)) xyouts, 0.2, 0.2, out_old, /norm, charsize=1.5, color=0 xyouts, 0.2, 0.2, ggg, /norm, charsize=1.5, color=k+1 oplot,abs(fft(findgen(2^k),-1)), color=k+1 out_old=ggg endfor return end ;----------------------------------------------------------- ----------- ;weird_fft_2.pro stop line ;----------------------------------------------------------- ----------- Looks like good old "don't use number of samples other than power of 2 with this routine"
creator: Sergei Senin
date: 1996-03-28T08:00:00-00:00

Re: FFT wierdness in WAVE
type: item
description: howie@skeefum.tamu.edu (Matt Howard) wrote: > > Can anyone here enlighten me on why the plots produced with the > following commands are so different? > > Other vector lengths which produce this strange behavior are; > > 5788 5788+16 5788+48 > 9848 9848-16 9848-32 > and others > >> plot,abs(fft(findgen(8395),-1)) - works! >> plot,abs(fft(findgen(8396),-1)) - fails! Peaks where none should be. > > The contents of the vector do not matter. When the vector length is > 8396 you get a spike on top of the proper spectrum. > > Any ideas? > > Now I'm certain that I missed a couple of lectures on FFT when I was studying at the university :-( Try this : ;----------------------------------------------------------- ----------- ;weird_fft.pro start line ;----------------------------------------------------------- ----------- pro weird_fft tek_color out_old=0 for k=0, 10 do begin if k eq 0 then plot_io ,abs(fft(findgen(8395),-1)), $ xrange=[-1000, 10000], $ color=1, /nodata ggg=strcompress(string(8395+k)) xyouts, 0.2, 0.2, out_old, /norm, charsize=1.5, color=0 xyouts, 0.2, 0.2, ggg, /norm, charsize=1.5, color=k+1 oplot,abs(fft(findgen(8395+k),-1)), color=k+1 out_old=ggg endfor return end ;----------------------------------------------------------- ----------- ;weird_fft.pro stop line ;----------------------------------------------------------- ----------- -- Sergei Senin ss@ee.port.ac.uk, http://www.ee.port.ac.uk:80/~ss-www/
creator: Sergei Senin
date: 1996-03-28T08:00:00-00:00

Re: FFT wierdness in WAVE
type: item
description: howie@skeefum.tamu.edu (Matt Howard) wrote (some text skipped -s.s.): > Can anyone here enlighten me on why the plots produced with the > following commands are so different? >> plot,abs(fft(findgen(8395),-1)) - works! >> plot,abs(fft(findgen(8396),-1)) - fails! Peaks where none should be. > Any ideas? I've noticed that it also takes WAVE much more time to calculate the one which fails
creator: Sergei Senin
date: 1996-03-28T08:00:00-00:00