Problem with FFT analysis of longer data sets

5 views (last 30 days)
I have a problem with a FFT analysis in MATLAB, which is probably related to my limited understanding of the fundamentals of Fourier analysis.
  • I use MATLAB’s built-in fft analysis function.
  • The sampling frequency is 48000Hz
  • The samples signal is a fairly clean sinus at 3000Hz (se below)
  • I use a flat top windowing.
  • I sample two voltage signals and use them to calculate the impedance of a device under test. An example of time data fed into the fft function, after windowing, is presented below
When I increases the sampling time from shorter to a longer times, e.g. 0.5sec to 1sec, I get incorrect impedance results (e.g. negative resistance). Intuitively I would assume that longer sampling times would increase the accuracy. I have tracked the difference between the two different sample times to a change of the sign of the imaginary part of the discrete Fourier transform output for the 3000Hz-frequency bin. I do not know if this can be related to the incorrect results. For the shorter sampling time the imaginary part of the DFT is negative, se below
And for the longer sampling time the imaginary part of the DFT is positive, se below
I am grateful for any ideas of what might be causing this issue? I'm also happy to provide additional information if needed.
Kind regards, Johan

Answers (1)

Wayne King
Wayne King on 15 Feb 2014
One thing that immediately comes to mind is that if you know the frequency of the sinewave, you should always pad the fft() so that 3000 Hz falls directly on a DFT bin. The bins are separated by Fs/N where N is the length of the DFT (including any padding).
Can you please include the MATLAB code you are using to compute the impedance from the DFTs of the input and output?
  1 Comment
Johan Gustafsson
Johan Gustafsson on 16 Feb 2014
Thanks for the answer, I zero pad to 48000samples, which is evenly dividable with 3000.
I have learned that if the sampled signal is shifted half a period the imaginary part of the spectrum at the sampled frequency switches sign. Is this correct? Se figure below...

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!