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

Home » Public Forums » archive » Re: Inverse transforming a product of FFTs
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Inverse transforming a product of FFTs [message #40044] Thu, 01 July 2004 13:44
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <52822646.0407010822.1dc890e@posting.google.com>,
olde_english33@hotmail.com (Eric) wrote:

> I have created two arrays of different time series. One is uniformly
> random, call it rantime, and the other one is based off of a recorded
> set of data values, call it rectime. Consider the following code,
> which I have implemented.
>
> specrantime=fft(rantime)
> specrectime=fft(rectime)
> prod=specrantime*specrectime
> yt=fft(prod, 1)
>
> Now, according to the help files, when you take the forward transform,
> the sum is multiplied by 1/N, which in my case is 31. My question is
> does taking the back transform of a product of two FFTs, both with 31
> variables, lose a factor of 31 when taking the inverse transform?
> That is, after I have computed the inverse transform, do I still need
> to multiply by a factor of 31 to get the right data out?

The inverse FFT of the product of the FFTs of f1 and f2 is equal to the
convolution of f1 and f2.

Try an example and see:

;Compute product of FFT's
n = 16
x = 2.0*COS(2.0*!PI*FINDGEN(n)/n)
z = FFT(FFT(x)*FFT(x), /INVERSE)
PRINT, x
PRINT, FLOAT(z)

;Compute convolution
conv = FLTARR(n)
dx = 1.0/n
FOR i = 0, n-1 DO conv[i] = TOTAL(x*SHIFT(x,i)*dx)
PRINT, conv


IDL> @fft_prod
2.00000 1.84776 1.41421 0.765367 -8.74228e-08
-0.765367 -1.41421
-1.84776 -2.00000 -1.84776 -1.41421 -0.765366
2.38498e-08 0.765367
1.41421 1.84776

2.00000 1.84776 1.41421 0.765366 -3.34942e-07
-0.765367 -1.41421
-1.84776 -2.00000 -1.84776 -1.41421 -0.765366
3.34942e-07 0.765367
1.41421 1.84776

2.00000 1.84776 1.41421 0.765367 2.98023e-08
-0.765367 -1.41421
-1.84776 -2.00000 -1.84776 -1.41421 -0.765367
7.45058e-09 0.765367
1.41421 1.84776

Since 31 is a prime, the FFT turns into a DFT, and you may be better off
computing the convolution directly.

Ken Bowman
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Licensing to Alpha Linux gone mad
Next Topic: Lambert Projection to Lat Lon

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

Current Time: Wed Oct 08 16:49:46 PDT 2025

Total time taken to generate the page: 0.00391 seconds