SquareWave
Advanced Analysis Library Only
AnalysisLibErrType SquareWave (ssize_t numberOfElements, double amplitude, double frequency, double *phase, double dutyCycle, double squareWave[]);
Purpose
Generates an array that contains a square wave. SquareWave generates the output array x according to the following formula:
xi = amplitude × square (phase + f × 360 × i)
where f is normalized frequency and where

You can use SquareWave to simulate a continuous acquisition from a square wave function generator. The unit of the input phase is in degrees, and SquareWave 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, or data points, to generate in the square wave signal. |
amplitude | double | Amplitude of the resulting square wave signal. Default Value: 1.0. |
frequency | double | Frequency of the resulting square wave signal in normalized units of cycles/sample. Default Value: 7.8125E-3 (1 cycle/128 samples). |
dutyCycle | double | Contains the duty cycle, in percent, of the generated square wave signal. Default Value: 50.0. |
Output | ||
Name | Type | Description |
phase | double | Points to the initial phase, in degrees, of the generated square wave signal. Upon completion of SquareWave, phase points to the phase of the next portion of the signal. Use this parameter in the next call to SquareWave to simulate a continuous acquisition. |
squareWave | double [] | The generated square 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