1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problems with FFT

  1. Feb 16, 2005 #1
    This is part of my senior project. Please help! I'm trying to use a code to FFT a real, even set of data, but the results are not real and even as would be expected.

    The code I'm using is availabe here (and fft.h andintl.h)

    When I run RealFFT with the following 16 numbers for the Real input and nothing for the Imag input, I get these results:

    Real input:

    Real output:

    Imag output:

    Any help? I've tried a different FFT code and the same thing happens. Help!! :cry:
  2. jcsd
  3. Feb 16, 2005 #2
    Is there some reason you can not use matlab, mathematica, or mathcad for their built in FFT?
  4. Feb 16, 2005 #3
    Everything has to be automated and separate, so I need to use code. This FFT is just a small part of the whole code.
    Last edited: Feb 16, 2005
  5. Feb 16, 2005 #4


    User Avatar
    Science Advisor

    I did a quick FFT using Excel on your data and, short of having sign issues with the imaginary output, your numbers are exactly the same that I got.

  6. Feb 16, 2005 #5
    The data is real and even though, isn't it? So, shouldn't the result also be real and even?
  7. Feb 16, 2005 #6


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member


    Though, IIRC, the imaginary parts can be computed from the real parts, so the real parts are all you actually need when the input is real.
  8. Feb 16, 2005 #7
    It should be real only if input sequence is symmetrical around t = 0. But you assume causal sequence (with FFT), so data is shifted and phase delay is introduced, by which you get imaginary component of spectrum...

    At least, that's off top of my head. Could be wrong...
  9. Feb 16, 2005 #8
    So how would I go about inputting data so that it would be interpreted as being symmetrical around t=0? According to the text that created the code I used, it is even if the values at k and (N-k) are the same.
  10. Feb 16, 2005 #9
    I just thought about what I wrote (I should do that BEFORE writing, right?). Well, since FFT (DFT) transform results with spectrum of periodic signal whose one period is the original sequence, it doesn't matter if the sequence is causal or not, FFT "percieves" it as periodic to + and - direction, hence the dicrete spectrum.

    I've input the data in Matlab, and got the same results. Shifting the array results only in different phase frequency characteristic.

    The seed of doubt in my mind is that I remember this: symmetrical real signals result in _linear_ phase characteristic, not by zero-phase...

    Anyway, I'm ill and it's quite late here, so I'll try to think straight in the morning (at least, I'll try ;) )
  11. Feb 17, 2005 #10


    User Avatar
    Science Advisor
    Homework Helper

    I think you're mixing up the indicies somehow. If your data set is indexed starting at zero and it's even, it will look like:

    [tex]\left[x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_7, x_6, x_5, x_ 4, x_ 3, x_2, x_1\right][/tex]

    In this case the output will be real assuming the input is. Your data is not of this shape, so you can't expect the nice cancellation.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Problems with FFT
  1. Problems with problems (Replies: 1)

  2. A problem (Replies: 2)