# Example Program Drafts

Showing results for
Search instead for
Did you mean:

# Power Spectrum Measurements for Simulated Signal

by on ‎09-08-2008 06:18 PM
• ### Example Code

This example computes the averaged power spectrum of a simulated input signal. You can specify various averaging modes for your measurement, such as RMS averaging, vector averaging, or peak hold, as well as the number of averages. You can observe the influence of these averaging parameters, typically on the noise floor, and notice that vector averaging requires the use of a trigger in order to lower the noise floor without lowering the fundamental along with it. You also can specify the type of window to use in this measurement, such as a Hanning or Flat Top.

The power spectrum, also called the energy spectral density, uses windowing, averaging, and Fast Fourier Transforms (FFT) to describe the energy of a signal distributed across frequency. That is, the power spectrum captures the power of a signal per unit frequency. A clarifying method for seeing the capability of the power spectrum is to analyze a signal containing a known frequency but have noise and other components added to the signal. The power spectrum will capture the energy of the embedded periodic signal in relation to the other components such as noise, this is also known as the signal to noise ratio.

This example lends itself to the basics of development in labVIEW. For this example, a signal is created, the signal is processed, and the output results are displayed on the front panel. These three steps are divided into their data flow operation in the block diagrams shown here:

1. Create Input Signal 2. Process Signal 3. Display Results

The FFT Power Spectrum VI completes the following steps to compute power spectrum:

1. Computes the FFT of time signal.
2. Forms the power spectrum of time signal.
3. Averages the current power spectrum with the power spectra computed in previous calls to the VI since the last time the averaging process was restarted.
4. Returns the averaged power spectrum in power spectrum.

The single-channel version of this VI can perform single-channel measurements in both one-shot mode, meaning a single call, and continuous mode, meaning multiple calls with history. The single-channel version can perform multichannel measurements only in one-shot mode. If you want to make multichannel measurements in continuous mode, use the multichannel version of this VI.

The single-channel version of this VI maintains internal state information for a single channel only. Calling the single-channel version to process another channel without using the restart averaging control to clear the history results in an unexpected behavior of this VI. The unexpected behavior results from the VI passing the internal state information from one channel to another.