# SawtoothWave

Advanced Analysis Library Only

AnalysisLibErrType SawtoothWave (int numberOfElements, double amplitude, double frequency, double *phase, double sawtoothWave[]);

## Purpose

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

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

where

and where f = frequency, in cycles/sample

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

## Parameters

Input
Name | Type | Description
numberOfElements | integer | Number of elements to generate in the sawtooth wave signal.
amplitude | double-precision | Amplitude of the resulting sawtooth wave signal. Default Value: 1.0.
frequency | double-precision | Frequency of the resulting sawtooth wave signal in normalized units of cycles/sample. Default Value: 7.8125E-3 (1 cycle/128 samples).
Output
Name | Type | Description
phase | double-precision | Pointer to the initial phase, in degrees, of the generated sawtooth wave signal.
phase | double-precision | Upon completion of SawtoothWave, phase points to the phase of the next portion of the signal. Use this parameter in the next call to SawtoothWave to simulate a continuous acquisition.
sawtoothWave | double-precision array | The generated sawtooth 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.