TriangleWave

Advanced Analysis Library Only

AnalysisLibErrType TriangleWave (int numberOfElements, double amplitude, double frequency, double *phase, double triangleWave[]);

Purpose

Generates an array that contains a triangle wave. TriangleWave generates the output array x according to the following formula:

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

where f = frequency, cycles/sample and where

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

Parameters

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

Default Value: 1.0.
frequency double-precision Frequency of the resulting triangle wave signal in normalized units of cycles/sample.

Default Value: 7.8125E-3 (1 cycle/128 samples).
Output
Name Type Description
phase double-precision Points to the initial phase, in degrees, of the generated triangle wave signal.
phase double-precision Upon completion of TriangleWave, phase points to the phase of the next portion of the signal. Use this parameter in the next call to TriangleWave to simulate a continuous function acquisition.
triangleWave double-precision array The generated triangle 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.