Admin Production ni-theme
Current Publication

AmpPhaseSpectrum

LabWindows/CVI

AmpPhaseSpectrum

Advanced Analysis Library Only

AnalysisLibErrType AmpPhaseSpectrum (double inputArray[], ssize_t numberOfElements, int unwrap, double dt, double amplitudeSpectrum[], double phaseSpectrum[], double *df);

Purpose

Calculates the single-sided, scaled amplitude and phase spectra of a time-domain signal, X. AmpPhaseSpectrum calculates the amplitude spectrum as

and converts it to single-sided form. AmpPhaseSpectrum calculates the phase spectrum as

phase(FFT(X))

and converts it to single-sided form.

Parameters

Input
Name Type Description
inputArray double [] The time-domain signal.
numberOfElements ssize_t Number of elements in the input array.
Default Value: 1024.
unwrap int Controls the unwrapping of the phase spectrum.

Specify a nonzero value or ENABLE_OPTION or select On in the function panel to enable phase wrapping. This is the default value.

Specify 0 or DISABLE_OPTION or select Off in the function panel to disable phase unwrapping.

(–Πphase)
dt double Sampling period of the time-domain signal, usually in seconds.
dt = 1/fs, where fs is the sampling frequency of the time-domain signal.
Default Value: 1.0.
Output
Name Type Description
amplitudeSpectrum double [] Single-sided amplitude spectrum magnitude in volts, root-mean-square, if the input signal is in volts. If the input signal is not in volts, the results are in input signal units, root-mean-square. This array must be at least numberOfElements/2 elements long.
phaseSpectrum double [] Single-sided phase spectrum in radians. This array must be at least numberOfElements/2 elements long.
df double Points to the frequency interval, in Hertz, if dt is in seconds.
df = 1/(numberOfElements × dt)

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