ArbitraryWave

Advanced Analysis Library Only

AnalysisLibErrType ArbitraryWave (int numberOfElements, double amplitude, double frequency, double *phase, double waveTable[], int tableSize, int interpolation, double arbitraryWave[]);

Purpose

Generates an array that contains an arbitrary wave, with each cycle described by an interpolated version of the waveTable you specify. ArbitraryWave generates the output array x according to the following formula:

xi = amplitude × arb (phase + f × 360.0 × i)

where arb(p) = WT(p modulo 360.0)
f is frequency in cycles per sample

ArbitraryWave calculates WT(x) according to the following interpolation values:

where ix = (int)x
dx = x — (int)x
(int) is the integral part of the variable x

You can use ArbitraryWave to simulate a continuous acquisition from an arbitrary wave function generator. The unit of the input phase is in degrees, and ArbitraryWave sets phase to
(phase + f x 360.0 x n) mod 360.0 before it returns.

Parameters

Input
Name Type Description
numberOfElements integer Number of elements to generate in the arbitrary wave signal.
amplitude double-precision Amplitude of the resulting wave.

The values in waveTable are multiplied by this amount when the function forms the arbitrary wave signal.

Default Value: 1.0.
frequency double-precision Frequency of the resulting arbitrary wave signal.

Frequency is in normalized units of cycles/sample.

Default Value: 7.8125E-3 (1 cycle/128 samples).
waveTable double-precision array Contains equally spaced samples of one cycle of the generated signal.
tableSize integer Number of elements that the waveTable array contains.
interpolation integer Determines the type of interpolation used to generate the arbitrary wave signal from the waveTable samples.

0 = no interpolation
1 = linear interpolation

Default Value: 0 (No Interpolation).
Output
Name Type Description
phase double-precision Points to the initial phase, in degrees, of the generated signal.
phase double-precision Upon completion of ArbitraryWave, phase points to the phase of the next portion of the signal. Use this parameter in the next call to ArbitraryWave to simulate a continuous function acquisition.
arbitraryWave double-precision array The generated arbitrary wave signal.

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.