Advanced Analysis Library Only
AnalysisLibErrType SpectrumUnitConversion (double spectrum[], int numberOfElements, int type, int scalingMode, int displayUnits, double df, WindowStruct windowConstants, double convertedSpectrum[], char unitString[]);
Converts the input spectrum, which is the power, amplitude, or gain, to alternate formats such as log, decibels or dBm, and spectral density.
Input | ||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||
spectrum | double-precision array | 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 | integer | Number of elements in the input spectrum. | ||||||||||||||||||
type | integer | Type of the input spectrum. type has the values shown in the following table.
|
||||||||||||||||||
scalingMode | integer | Type of the scaling of the output spectrum. scalingMode has three selections for the output unit type, as shown in the following table.
|
||||||||||||||||||
displayUnits | integer | Unit of the output spectrum, assuming "V" for unitString.
The last four selections are amplitude spectral density (4, 5) and power spectral density (6, 7). |
||||||||||||||||||
df | double-precision | The frequency interval, in Hertz, as output by AmpPhaseSpectrum,
AutoPowerSpectrum, CrossPowerSpectrum,
NetworkFunctions, or TransferFunction. 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 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-precision | 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 | string | 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). |
Name | Type | Description |
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |