Re: FFT wierdness in WAVE [message #6080] |
Thu, 28 March 1996 00:00 |
Jackel
Messages: 30 Registered: April 1993
|
Member |
|
|
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
|
|
|
Re: FFT wierdness in WAVE [message #6082 is a reply to message #6080] |
Thu, 28 March 1996 00:00  |
Sergei Senin
Messages: 23 Registered: February 1996
|
Junior Member |
|
|
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"
|
|
|
Re: FFT wierdness in WAVE [message #6083 is a reply to message #6080] |
Thu, 28 March 1996 00:00  |
Sergei Senin
Messages: 23 Registered: February 1996
|
Junior Member |
|
|
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/
|
|
|
Re: FFT wierdness in WAVE [message #6084 is a reply to message #6080] |
Thu, 28 March 1996 00:00  |
Sergei Senin
Messages: 23 Registered: February 1996
|
Junior Member |
|
|
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
|
|
|