LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Performing FFT Spectrum on Logged Data

Hi,

I'm having difficulties performing an FFT plot of data I am logging from an NI USB-6218 in LabView NXG 2.1. I am new to LabView and FFT's so forgive any mistakes I make.

 

At the moment, I am trying to take the FFT spectrum of a 50Hz 2 Volt signal and a 20Hz 3 Volt signal and then display the magnitude-phase and real-imaginary data all in Frequency vs. Magnitude formats. From what I've learned about FFT's, I should be seeing a spike for each channel at their respective frequencies that extends to their respective amplitudes, however I am not seeing that when I plot it directly. I'm guessing that I need to factor something else into the plot but I just do not know.

 

I have attached pictures of my code and results.

 

Thanks for your help!

Download All
0 Kudos
Message 1 of 3
(2,282 Views)

Update:

I figured out that I wasn't actually plotting frequency versus magnitude, I was plotting magnitude index versus magnitude. I used the equation: f = Fs*(0:(L/2))/L where f is the frequency domain, Fs is the sampling rate, and L is the amount of samples. So that part of the problem is solved.

 

Only remaining issue is that the magnitude displayed is not the same as the amplitude of the graph as it should be. I believe it has to do with spectral leakage but I don't know how to approach that. Thanks for any help!

0 Kudos
Message 2 of 3
(2,235 Views)

Not sure if this is what you are asking, but your plots in magnitude are showing the RMS amplitude, take 1/2 of your peak to peak amplitude and multiply by square root of 2 to get what you see. If you want your spectrum to display peak-to-peak amplitude or peak amplitude then you need to multiply your FFT by the appropriate constant. (Hint I told you how to go in one direction, now just reverse it for what you need.)

 

mcduff

0 Kudos
Message 3 of 3
(2,225 Views)