LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does the Power Spectral Density function account for amplitude inaccuracy caused by the window function?

Solved!
Go to solution

I am new to this forum, so please let me know if this would better fit in a different discussion board.

 

Here's the question:

I would like to know if the Power Spectral Density function ("FFT PSD for 1 Channel.vi") automatically compensates for the input amplitude loss caused by the window function.  In other words, is a window-specific correction factor applied within the PSD vi or do I need to apply one manually?

 

Background detail:

I tried to answer the question myself by generating a Sine wave and sampling it such that it is periodic within the time record (i.e. 0 at each end of the time record).  The frequency of the Sine wave was such that the frequency would exactly match a spectral line in the PSD.  I then generated the PSD of the Sine wave twice: once using a Hanning window and once using a Rectangular window (no averaging in either case).  The magnitude of the Rectangular windowed PSD at the frequency of the Sine wave was 1.5 times greater than the magnitude of the PSD with a Hanning window applied.

 

The experiment above indicated to me that a manual adjustment of the PSD output for the window function was necessary, however, I repeated the above experiment using some random vibration data and didn't see a clear 1.5x factor.  I've also been told by colleagues that the PSD should adjust for the window function.

 

Thank you for your input.

0 Kudos
Message 1 of 8
(5,290 Views)

If you open the PSD VI (and its subVIs), you can see that it divides by the bandwidth multiplied by df.  So it accounts for the equivalent noise bandwidth of the window.

 

Lynn

0 Kudos
Message 2 of 8
(5,281 Views)

Thank you for your message.

 

Do you have any thoughts on why I see a 1.5X factor on the amplitude in my Sine wave experiment (described in my first posting) between the Rectangular and Hanning windows?  I would think the PSD would adjust for this.  By the way, 1.5 happens to be the Noise Power Bandwidth of the Hanning Window as shown in http://zone.ni.com/devzone/cda/tut/p/id/4278.

 

Did I land in some special case by testing the PSD with a pure sign wave?

 

Thanks again.

0 Kudos
Message 3 of 8
(5,276 Views)

How many cycles of the sine wave did you use in your testing?

 

Lynn

0 Kudos
Message 4 of 8
(5,273 Views)

The input wave was 8SIN(2Pi500t) which I sampled at 0.00005s/sample (20kHz) for 2000 samples (0.1s).  So there are 50 complete cycles in the sample.  The resulting PSD has either a magnitude of 2.1333 g^2/Hz (with a Hanning Window) or 3.2g^2/Hz (with a Rectangular Window) at 500Hz. 

 

I'm calling the units "g" since most of the time I'm dealing with acceleration data.

0 Kudos
Message 5 of 8
(5,265 Views)
Solution
Accepted by topic author JPDLG

Spectral leakage.  When you use finite sample of data the resulting spectrum is the convolution of the spectrum of your signal as though it extended infinitely in time with the spectrum of the window.  Even if you do not use a window function, you effectively have a rectangular window the same width as the sample set size.

 

Plot the output of the PSD VI with the Plot style set to show dots at the data points. Turn off autoscaling on the X axis and expand the graph around your peak. Look at the results for various windows.  In every case there are multiple non-zero values.  With real sampled data of finite duration you will never get the idealized line spectrum.

 

If you sum the spectral outputs the value stays close to 3.2 for all windows.

 

Lynn

Message 6 of 8
(5,253 Views)

Thank you Lynn.  I think I get it now.  I wasn't able to open your VI since I'm using Labview 8.5, but your point about summing all the values and getting the same result helped me to grasp the idea.

 

Here's my synopsis - please let me know if it is accurate:

The PSD algorithm does adjust for the energy loss associated with applying a window function to the time-domain data.  This can be proven by summing the PSD values across all spectral lines.  Regardless of the window type applied to the time waveform, the sum of the PSD values across all spectral lines will be the same.

 

Although the overall energy in the PSD is the same regardless of window type, the distribution of the energy across the frequency range will differ according to the spectrum of the window function.  For the PSD of the 8Sin(2Pi500t) waveform, certain window types will result in a PSD with energy distributed across a narrow frequency band (centered on 500Hz) with a high amplitude.  Other window types will result in a PSD with energy distributed across a wider frequency band with a lower amplitude.

0 Kudos
Message 7 of 8
(5,235 Views)

Yes.  That is a pretty good summary.

 

Of course the summation across the spectrum works for single frequency signals.  If you have signals with multiple frequency components or signals which have time-varying spectra, you need to be more careful to define exactly what energy you are calculating.

 

Here is a version saved back to 8.5 (unchecked).

 

Lynn

0 Kudos
Message 8 of 8
(5,230 Views)