LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between LabVIEW FFT and Matlab FFT

Solved!
Go to solution

Does anyone know why there is an offset in the absolute levels of the results of the FFT function in LabVIEW and Matlab?

 

See the attached VI for an example of my LV code.

 

Also attached is the plot generated in Matlab, which seems to be offset by ~37dB.

 

This was generated using the command 'plot(10*log10(abs(fft(x))))', where x is the same input array as in the VI.

 

Many thanks,

Dan

Dan
CLD
Download All
0 Kudos
Message 1 of 3
(6,048 Views)
Solution
Accepted by topic author DanB1983
I see that you are using the FFT Spectrum VI which returns a single sided spectrum.  To convert from a two sided transform (ie FFT) to a single sided spectrum with RMS units there is a normalization of sqrt(2)/N where N is the number of points in x(t).  You can premultiply your x(t) by N/sqrt(2) and get the same results as Matlab.  Or, you could use the FFT.vi so you are comparing transform to transform instead of spectrum to transform.
Message 2 of 3
(6,008 Views)

Stupid question but in your Vi final the waveform graph on the Control Panel shows up as a double in the programming window. When I make waveform graphs they end up being a little graph in the programming window. What's the difference if there is one?

0 Kudos
Message 3 of 3
(5,309 Views)