Admin Production ni-theme
Current Publication

TriangleWave

LabWindows/CVI

TriangleWave

Advanced Analysis Library Only

AnalysisLibErrType TriangleWave (ssize_t 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 frequency = 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 × 360.0 × n) modulo 360.0 before it returns.

Parameters

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

Default Value: 1.0.
frequency double 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 Points to the initial phase, in degrees, of the generated triangle wave signal.

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 [] 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.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later

Examples

Refer to the following examples that use the TriangleWave function:

  • analysis\convolve.cws

    Open example
  • analysis\correlat.cws

    Open example
  • analysis\peakest.cws

    Open example