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

Home » Public Forums » archive » Re: Again an FFT question
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: Again an FFT question [message #80657 is a reply to message #80652] Wed, 27 June 2012 08:53 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <614d4d33-39a8-4059-bc5f-f99f08fbc966@googlegroups.com>,
Helder <helder@marchetto.de> wrote:

> Dear FFTers,
> I was just wondering about the translation of the FFT so that the what is
> located at (0,0) goes in the middle of the image (N/2,M/2).
> Until now I did this doing simply a shift of the FFT image, that is:
> FFT_Img = SHIFT(FFT(Img),N/2,M/2)
> Now I have seen that some people use a FFT "trick" to shift the image. They
> switch every second pixel of an image to its negative value. This is
> justified by the translation properties of the DFTs and results in a
> translation of half the image size (for those seeking to understand the math,
> try to multiply the function (image) by exp(i*2*Pi(u0*x/N)) and after
> integration you will get a translation of the Fourier image (signal for 1D)
> of F(u-u0).


>
> The result is that the two are not exactly the same. Very similar, but not
> the same.
> I have tried varying the size of the image or switching even instead of odd
> numbers index numbers , but could not get any improvement (with odd image
> sizes, the difference is even higher).
>
> Does anybody have a reason to use one way (shift(fft(Img...))) rather than
> the other (switch pixels with index ((x+y) MOD 2 EQ 1)?
>
> I'm more confident using SHIFT, but I would just like to understand why the
> other method gives different values.
>
> Thanks,
> Helder

If you do an FFT of an 8-point array, the output frequencies are
stored in this order

f = [0, 1, 2, 3, 4, -3, -2, -1]

The IDL FFT always does a complex FFT. If the input data are real,
then the real part of f=0 is the mean, the imaginary part is 0 to
within roundoff error.

The positive and negative frequencies are complex conjugates of
each other - again within roundoff error.

I think the differences that you are seeing are due to round-off
error. Check the magnitudes of the differences.

Ken Bowman
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: problem in the path
Next Topic: Re: problem in the path

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

Current Time: Wed Oct 08 15:28:03 PDT 2025

Total time taken to generate the page: 0.00710 seconds