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

Home » Public Forums » archive » Re: time vs longitude 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: time vs longitude FFT [message #56548 is a reply to message #56542] Mon, 29 October 2007 14:14 Go to previous messageGo to previous message
knielsen73 is currently offline  knielsen73
Messages: 9
Registered: October 2007
Junior Member
On Oct 29, 2:41 pm, "R.G. Stockwell" <noem...@please.com> wrote:
> <knielse...@gmail.com> wrote in message
>
> news:1193671433.271745.268030@57g2000hsv.googlegroups.com...
>
>> Hi,
>
>> I have a time vs longitude plot and would like to do a 2-D FFT to get
>> a frequency vs wavenumber plot. I used the IDL FFT but I am not sure
>> what the output is...I didn't feel the IDL help was very helpful
>> there. I found a post from 1998 but there were some non-defined
>> functions and I wasn't exactly sure what they did.
>
>> Does anybody have a good example on how to use 2D FFT in IDL or some
>> good documentation?
>
> a little example:nx = 100
> ny = 200
> x = (fltarr(ny)+1) ## findgen(nx)
> y = findgen(ny) ## (fltarr(nx)+1)
> kx = 20.5/nx
> ky = 0./ny
>
> ;image
> a =cos(2*!pi*(kx*x + ky*y))
>
> ;spectrum in 2d
> spe = fft(a)
>
> kxvalues = findgen(nx)/nx - 1./2
> kyvalues = findgen(ny)/ny - 1./2
>
> !p.multi=[0,1,2]
> contour,a,/fill,nlevels=14
>
> ; shift to get the normal representation,
> ; i.e. (neg kx, 0, pos kx)
> shiftspe = shift(spe,nx/2,ny/2)
>
> contour,abs(shiftspe),kxvalues,kyvalues,/fill,nlevels=14
>
> Note: it is symmetric about the origin.
>
> Cheers,
> bob

Thanks Bob,

I works great with your example. However, when I made a wave with a
wavenumber larger than 1, the scale no longer agrees. I can plot it
"raw", but again, not sure how to read the values with respect to the
real wave number and frequency. Here is the wave I gave as input.

;input a wave number two with an amplitude of 10.
;and eastward phase propagation of 1.7 days

amp = 10.
wave_number = 2
wavelength = float(jmax)/wave_number
period = 6.8333333

for j=0,jmax-1 do begin
for n=0,nmax-1 do begin
data_in[j,n] = amp*sin(2.*!pi*j/wavelength - 2.*!pi*n/period) +$
amp*.5*cos(2.*!pi*j/wavelength - 2.*!pi*n/period)
endfor
endfor

Cheers,
Kim
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL + Leopard
Next Topic: more IDL/Leopard issues

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

Current Time: Wed Oct 08 19:17:57 PDT 2025

Total time taken to generate the page: 0.00371 seconds