ArbitraryWave
Advanced Analysis Library Only
AnalysisLibErrType ArbitraryWave (ssize_t numberOfElements, double amplitude, double frequency, double *phase, double waveTable[], ssize_t waveTableSize, 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 arbitraryWave according to the following formula:
xi = amplitude × arb (phase + f × 360.0 × i)
where | arb(p) = WT(p modulo 360.0) |
frequency is frequency in cycles per sample |
ArbitraryWave calculates WT(arbitraryWave) according to the following interpolation values:

where | ix = (int)arbitraryWave |
dx = arbitraryWave – (int)arbitraryWave | |
(int) is the integral part of the variable arbitraryWave |
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 × 360.0 × n) mod 360.0 before it returns.
Parameters
Input | ||
Name | Type | Description |
numberOfElements | ssize_t | Number of elements to generate in the arbitrary wave signal. |
amplitude | double | 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 | 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 [] | Contains equally spaced samples of one cycle of the generated signal. |
waveTableSize | ssize_t | Number of elements that the waveTable array contains. |
interpolation | int | Determines the type of interpolation used to generate the arbitrary wave signal from the waveTable samples. Specify a nonzero value or LINEAR_INTERPOLATION or select Linear in the function panel to use linear interpolation. Specify 0 or NO_INTERPOLATION or select None in the function panel if you do not want to use interpolation. This is the default value. |
Output | ||
Name | Type | Description |
phase | double | Points to the initial phase, in degrees, of the generated signal. 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 [] | 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. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later