LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT peak off.

Solved!
Go to solution

Hi,

 

I am sampling signal with my PXIe-5774 fpga (3.2 GS/s) and sending that data to my pc. The signal coming to my PXIe-5774 is a 20 MHz sine-wave (other input is just noise). The raw data looks like this:

IhmeKyselij_0-1685516683884.png

When I calculate an FFT from it using this code:

IhmeKyselij_1-1685516779309.png

the frequency spectrum looks like this (I have scaled it as there are no other peaks at higher frequencies):

IhmeKyselij_2-1685516842312.png

As you can see the peak is not at 20 MHz but is a bit off at around 30 MHz. Why is this? I have tried all the windowing functions and have changed the sine-wave frequency to have it have an interger multiple of periods per sample but this phenomenon persists.

 

Thanks:

Aarni

 

0 Kudos
Message 1 of 4
(761 Views)

The short answer is that you're using the wrong method to get the amplitude spectrum.  If you use "FFT Power Spectrum and PSD", the peak should appear at the correct frequency, although the spectrum will be in squared "power" units.

 

Andy

0 Kudos
Message 2 of 4
(721 Views)

OK, that *shouldn't* make a difference to where the peak in the spectrum appears - it was just the first thing I tried.

 

The correct answer is that your complex arithmetic functions aren't doing quite what you expect because they're operating on clusters.  The Re/Im To Complex gives you correct data values but sets the f0 and df elements of the output cluster to complex numbers.  This causes a problem because Waveform Graph uses these to determine the x-axis values, i.e. the frequency base.

 

Extract the data arrays from the real and imaginary clusters before doing any further calculation, or maybe just use the version of the FFT Spectrum VI that gives you magnitude and phase output in the first place?

 

Andy

0 Kudos
Message 3 of 4
(706 Views)
Solution
Accepted by IhmeKyselijä

In other words, don't take the magnitude of the x axis information.

 

Simple solution: Instead of using the FFT Re-IM, use the FFT mag-phase and just graph the magnitude. No math needed!

 

altenbach_0-1685543111131.png

 

Message 4 of 4
(689 Views)