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

Home » Public Forums » archive » Different FFT-results on vector and array?!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Different FFT-results on vector and array?! [message #4438] Tue, 30 May 1995 00:00
jan is currently offline  jan
Messages: 1
Registered: May 1995
Junior Member
Distribution: world

When checking out amplitude and phase of a given frequency in several
subwindows of a given timewindow I ran into the following problem:

I have to FFT the array "data(dim,3)" where dim is a given long
integer. In the first step I perform the FFT on the whole array at once
and in the second try I perfom the FFTs on data(*,0), data(*,1) and
data(*,2).
The results are stored in both cases in temp(*,*).
My problem is: these two strategies yield different results...

Following I attached the relevant code of both cases...
(variables n1, n2, k, freq and delta are predefined in the code before)

---FFT on the array at once:
REPEAT BEGIN
dim = LONG(N_ELEMENTS(data(n1:n2,0)))
ff = FLTARR(dim/2+1,3)
pp = FLTARR(dim/2+1,3)
temp = COMPLEXARR(n2-n1+1,3)
temp2 = 1000.*data(n1:n2,*)
temp = FFT(temp2,-1)
ff = FLOAT(temp(0:dim/2,*))
pp = IMAGINARY(temp(0:dim/2,*))
k = k + 1
a(k,freq,*) = ff(freq,*) ;a is FLTARR(k_max,freq_max,3)
p(k,freq,*) = pp(freq,*) ;p is FLTARR(k_max,freq_max,3)
n1 = n1 + delta
n2 = n2 + delta
ENDREP UNTIL (<certain condition is true>)
---

---FFT on vectors containing the array-columns:
REPEAT BEGIN
dim = LONG(N_ELEMENTS(data(n1:n2,0)))
ff = FLTARR(dim/2+1,3)
pp = FLTARR(dim/2+1,3)
temp = COMPLEXARR(n2-n1+1,3)
temp2 = 1000.*data(n1:n2,0)
temp(*,0) = FFT(temp2,-1)
temp2 = 1000.*data(n1:n2,1)
temp(*,1) = FFT(temp2,-1)
temp2 = 1000.*data(n1:n2,2)
temp(*,2) = FFT(temp2,-1)
ff = FLOAT(temp(0:dim/2,*))
pp = IMAGINARY(temp(0:dim/2,*))
k = k + 1
a(k,freq,*) = ff(freq,*) ;a is FLTARR(k_max,freq_max,3)
p(k,freq,*) = pp(freq,*) ;p is FLTARR(k_max,freq_max,3)
n1 = n1 + delta
n2 = n2 + delta
ENDREP UNTIL (<certain condition is true>)
---

When plotting a(i,freq,[0,1,2]) over i I get different results for the
above two cases. All surrounding code, including the
stop-repeat-condition is _exactly_ the same for both routines. I'm sure
there must be a pretty silly mistake - however, I can't figure out
where it is ...

Any hints?
Thanks in advance,
Jan
(e-mail is welcome, too)
---------------------------------------
Jan J. Krueder
German Aerospace Research Establishment
Institute of Space Simulation
privat : jan@spacelab.greenie.muc.de
office : jan.kruder@europa.rs.kp.dlr.de
---------------------------------------
[Message index]
 
Read Message
Previous Topic: Re: Clever Where() test
Next Topic: IDL Training given by RSI

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

Current Time: Thu Oct 09 19:56:46 PDT 2025

Total time taken to generate the page: 0.48011 seconds