# PowerFrequencyEstimate

Advanced Analysis Library Only

AnalysisLibErrType PowerFrequencyEstimate (double autoSpectrum[], int numberOfElements, double searchFreq, WindowStruct windowConstants, double df, int freqSpan, double *freqPeak, 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-precision array | Single-sided power spectrum as output by AutoPowerSpectrum.
numberOfElements | integer | Number of elements in the input autoSpectrum array.
searchFreq | double-precision | 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 | WindowStruct | 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-precision | Frequency interval, in Hertz, as output by AmpPhaseSpectrum, AutoPowerSpectrum, CrossPowerSpectrum, NetworkFunctions, or TransferFunction. Default Value: 1.0.
freqSpan | integer | 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
freqPeak | double-precision | Points to the estimated frequency of the estimated peak power in autospectrum.
powerPeak | double-precision | 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.