Admin Production ni-theme
Current Publication

PowerFrequencyEstimate

LabWindows/CVI

PowerFrequencyEstimate

Advanced Analysis Library Only

AnalysisLibErrType PowerFrequencyEstimate (double autoSpectrum[], ssize_t numberOfElements, double searchFrequency, WindowConst windowConstants, double df, ssize_t frequencySpan, double *frequencyPeak, double *powerPeak);

Purpose

Calculates the estimated power and frequency around a peak in the power spectrum of a time-domain signal. With PowerFrequencyEstimate, you can achieve good frequency estimates for measured frequencies that lie between frequency lines on the spectrum. PowerFrequencyEstimate also makes corrections for the window function you use.

PowerFrequencyEstimate calculates the estimated frequency peak using the following formula:

PowerFrequencyEstimate calculates the estimated power peak as follows:

where i = index of the searchFreq
df is the frequency interval, usually in Hertz, as output by the AutoPowerSpectrum function
enbw is the equivalent noise bandwidth member of the structure windowConstants as output by the ScaledWindowEx function

Parameters

Input
Name Type Description
autoSpectrum double [] Single-sided power spectrum as output by AutoPowerSpectrum.
numberOfElements ssize_t Number of elements in the input autoSpectrum array.
searchFrequency double Frequency, usually in Hertz, of the frequency around which you want to estimate the frequency and power. If searchFreq is less than zero or is not a valid frequency, PowerFrequencyEstimate automatically searches for the maximum peak in the autoSpectrum array and estimates the frequency and power around the maximum peak.
Default Value: –1.0.
windowConstants WindowConst Structure that contains the following useful constants for the selected window:
enbw is the equivalent noise bandwidth of the selected window. You can use this value to scale a sum of individual power spectra of the power spectrum or to calculate the power in a given frequency span.
coherentgain is the peak gain of the window, relative to the peak gain of the Rectangular window. PowerFrequencyEstimate uses this value to normalize peak signal gains to that of the Rectangular window.
ScaledWindowEx creates the windowConstants structure.
df double Frequency interval, in Hertz, as output by AmpPhaseSpectrum, AutoPowerSpectrum, CrossPowerSpectrum, NetworkFunctions, or TransferFunction.
Default Value: 1.0.
frequencySpan ssize_t Number of frequency lines, or bins, around the peak to include in the peak frequency and power estimation. The estimation includes the power in freqSpan/2 frequency lines before the peak frequency line, the peak frequency line itself, and freqSpan/2 frequency lines after the peak.
Default Value: 7.
Output
Name Type Description
frequencyPeak double Points to the estimated frequency of the estimated peak power in autospectrum.
powerPeak double Points to the estimated peak power in autospectrum.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later

Example

Refer to analysis\peakest.cws for an example of using the PowerFrequencyEstimate function.