CxSingleToneInfo
Advanced Analysis Library Only
AnalysisLibErrType CxSingleToneInfo (NIComplexNumber waveform[], ssize_t waveformSize, double samplePeriodInSeconds, SearchType *search, double *frequency, double *amplitude, double *phase);
Purpose
Takes a complex signal, finds the single tone with the highest amplitude or searches a specified frequency range, and returns the single tone frequency, amplitude, and phase.
This function is similar to CxSingleToneSignal, except that CxSingleToneInfo does not export any values, which makes this function makes it easier to use. If you need to export signal and spectrum information, you can use CxSingleToneSignal instead.
A complex tone signal can be expressed as shown in the following equation:
where A, f, and are the amplitude, frequency, and phase of the tone signal, respectively, and Fs is the sample rate in samples per second of the input waveform signal.
For a complex signal, the frequency range is (min frequency, max frequency) = (–Fs/2, Fs/2).
Parameters
Input | ||
Name | Type | Description |
waveform | NIComplexNumber [] | The input waveform to measure. |
waveformSize | ssize_t | The size of the input waveform. This value must be greater than 2. |
samplePeriodInSeconds | double | Sample period of the time-domain signal, in seconds. This value must be greater than 0. |
search | SearchType * | Controls the frequency domain search area, center frequency, and width. Use this parameter to narrow the single tone search range. The SearchType structure is defined as follows: typedef struct { double centerFrequency; double frequencyWidth; } SearchType; search->centerFrequency is the center frequency used for the frequency domain search of the single tone. This value is in the range of (-Fs/2, Fs/2), where Fs is the sampling rate, and Fs = 1.0/dt. search->frequencyWidth is the frequency width, as a percentage of the sampling rate. If you pass NULL for search or search->centerFrequency is invalid, this function searches the tone in the full frequency range of (-Fs/2, Fs/2). |
Output | ||
Name | Type | Description |
frequency | double | The frequency of the detected single tone, in hertz. If an error occurs, frequency is set to 0.0. |
amplitude | double | The amplitude of the detected single tone. If an error occurs, amplitude is set to 0.0. |
phase | double | The phase of the detected single tone, in degrees. If an error occurs, phase is set to 0.0. |
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 2010 and later