In file No file:

int sineAnalyze (int flag, int window, const float x[], int npt, double fs, double fsine, int nAvg, double toff, dCmplx* sine_amp, dCmplx sineVals[])

Calculates amplitude & phase of a sine wave in time series data

Documentation

This function calculates the complex amplitude of a fourier component in a time series. The data is first mixed-down - ie, it is muliplied by exp(2pi*i*fsine*t). The resulting real & imaginary parts are each low-pass filtered with an FIR filter, and numerically integrated over an integral number of cycles of fsine to extract the amplitude at fsine. Multiple measurements can be made on successive pieces of data by setting the number of averages, nAvg >1. The function returns both the averaged complex amplitude, and an array of amplitudes from each measurement; the latter would be used to calculate the coherence with another channel. The amplitude is normalized so that the magnitude is the peak amplitude of the sine-wave. To determine the number of input data points needed, the function sweptSineNpts should be used. The toff argument can be used to pass a time offset to the mixdown (heterodyne) function (which sineAnalyze calls). The flag argument is used to control a offset removal option: 0 for no action; 1 to remove the mean from the input time series. The data array must cover a minimum of one full sine cycle per required average plus the number of lead terms plus one, otherwise the function returns with an error of -2. The function will truncate the number of points for each average so that the last point just comes after the zero crossing of the last cycle. Optionally, a window function can be applied to the down-converted time series to minimize leakage from close-by frequencies.

Returns:
GDS_ERROR
Parameters:
flag - offset removal option
window - type of window function to be used
x - input time series
npt - number of points in the input array
fs - sampling rate of input time series
fsine - frequency at which sine is calculated
nAvg - number of averages ( of independent measurements)
toff - phase offset for the mixdown function
sine_amp - complex amplitude of sine wave (return)
sineVals - array of individual amplitudes, nAvg total (return)
Author:
PF, Dec 1998
See Also:

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++