SpectrumUnitConversion
Advanced Analysis Library Only
AnalysisLibErrType SpectrumUnitConversion (double spectrum[], ssize_t numberOfElements, int type, int scalingMode, int displayUnits, double df, WindowConst windowConstants, double convertedSpectrum[], char *unitString);
Purpose
Converts the input spectrum, which is the power, amplitude, or gain, to alternate formats such as log, decibels or dBm, and spectral density.
Parameters
Input | ||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||
spectrum | double [] | Input array that contains a spectrum of the type specified by the spectrum selector. This value must be a power, amplitude, or gain spectrum. |
||||||||||||||||||
numberOfElements | ssize_t | Number of elements in the input spectrum. | ||||||||||||||||||
type | int | Type of the input spectrum.
|
||||||||||||||||||
scalingMode | int | Type of the scaling of the output spectrum. scalingMode has three selections for the output unit type, as shown in the following table.
|
||||||||||||||||||
displayUnits | int | Unit of the output spectrum, assuming "V" for unitString.
|
||||||||||||||||||
df | double | The frequency interval, in Hertz, as output by AmpPhaseSpectrum, AutoPowerSpectrum, CrossPowerSpectrum, NetworkFunctions, or TransferFunction. 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 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. SpectrumUnitConversion uses this value normalize peak signal gains to that of the Rectangular window. ScaledWindowEx outputs this structure. |
||||||||||||||||||
Output | ||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||
convertedSpectrum | double [] | Input spectrum, power, amplitude, or gain, to convert to alternate formats such as log, decibels or dBm, and spectral density. The size of this array must be at least numberOfElements. | ||||||||||||||||||
unitString | char | On input, the string that contains the base unit of the analyzed signal; V for a voltage signal. Upon completion of SpectrumUnitConversion, the unit of the output convertedSpectrum. The size of this string must be at least (12 + size of unitString). |
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 SpectrumUnitConversion function.