LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fft amplitude scaling

I am trying to use the vi "FFT Spectrum (Mag-Phase) VI", and I made a sample program to test it out, but I have encountered a problem regarding the scaling that I am confused by. The LabVIEW program is attached. In this program I create two sine waveform generators of ampltude 1 and with two different frequencies (20 and 30 Hz), and I append them together before sending them into the FFT vi. My problem is that I don't understand the output in the amplitude spectrum graph. It shows two peaks situated at the right frequencies, but their amplitudes aren't what I was expecting. The amplitude of the peaks are about ~0.35, but I was expecting them to both be 1 since I was inputing two sine waves with amplitude 1. Obviously the scaling is wrong, but I don't understand why. How do I correct this? Also, lets say I append together 20 sinewaves instead of two as in the example shown or instead input some generated noise. How would I scale the resuts so that everything would result with the expected amplitudes I was expecting?

0 Kudos
Message 1 of 4
(3,799 Views)

I assume you know that "Append Waveform" sticks the second Waveform on the end of the first, generating a single Waveform whose length is the sum of the two lengths.  Were you trying to add the Waveforms to get a single waveform with both signals appearing "on top of" each other?

 

I also noticed you didn't plot the signal, but only the spectrum.  If you had, you would probably see the problem, yourself.

 

Bob Schor

0 Kudos
Message 2 of 4
(3,779 Views)

In addition to waht Bob already mentioned:

 

  • What is the purpose of all the t0 manipulations?
  • What is te purpose of the expression node?
0 Kudos
Message 3 of 4
(3,767 Views)

OK, here are a few tips:

 

  • The peak amplitudes will NOT be 1.00, but about 0.71, which is the RMS value (read the help!). Your amplitudes were half that, because you were appending instead of adding, doubling the length and thus diluting each waveform.
  • The peaks will be broadened because there is a default Hanning windows applied. To avoid that, you should select window 0:rectangular on your FFT function.
  • Please try to avoid all the duplicate code. You only need one diagram constant for each value. You could use a FOR loop to generate the various waveforms to be added.

Here's a very simple example how it could look like.

 

0 Kudos
Message 4 of 4
(3,757 Views)