LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Performing FFT on data outside while loop

Hi, I am tasked with generating an AC signal with labview and using that signal to output current through a power supply. The power supply then generates a modulating magnetic field. I then measure the magnetic field using another hardware device. On a waveform chart, the magnetic field is a sine wave.  I am able to complete all of this under a single while loop and my code is correct. My problem is when I try to take the fourier transform of the magnetic field data I have to index it out through the while loop. The graph I am getting after performing the fourier transform does not have the same frequency as the signal i generated originally and does not match up with the amplitude of the magnetic field data. My goal is to have the amplitude of the magnetic field sine wave appear on my graph at the original frequency I used to generate my signal.I have been using the amplitude and phase spectrum VI and multiplying the output by the square root of 2 to cancel out the rms portion of the amplitude. Does anyone know why I am having this problem and how to fix it? Please let me know if you have a solution to this problem. Thanks!! 

0 Kudos
Message 1 of 2
(2,545 Views)

When in doubt, write simpler code.  There may still be a problem.  I wrote a two-function program that generated a sinusoid then took its spectrum.  If I multiply the amplitude spectrum by sqrt(2), I get exactly the expected answer (at the stimulus frequency).  I'm not as happy with the phase, which seems "off" to me (I'll leave this to you to figure out).

FFT.png

 

Bob Schor

0 Kudos
Message 2 of 2
(2,508 Views)