![]() |
reset phase determines the initial phase of Square Wave. The default is TRUE. If reset phase is TRUE, the initial phase is set to phase in. If reset phase is FALSE, the initial phase is set to the value of phase out when the VI last executed. |
![]() |
samples is the number of samples of the Square Wave. The default is 128. |
![]() |
amplitude is the amplitude of Square Wave. The default is 1.0. |
![]() |
f is the frequency of Square Wave in normalized units of cycles/sample. The default is 1 cycle/128 samples or 7.8125E-3 cycles/sample. |
![]() |
phase in is the initial phase, in degrees, of Square Wave when reset phase is TRUE. phase in default is 0. |
![]() |
duty cycle is the duty cycle, in percent, of the Square Wave. |
![]() |
Square Wave is the output square wave. |
![]() |
phase out is the phase, in degrees, of the next sample of Square Wave. |
![]() |
error returns any error or warning from the VI. Refer to Signal Processing Error Codes for more information about these conditions. |
If the sequence Y represents Square Wave, the Square Wave VI generates the pattern according to the following formula.
yi = a * square(phase[i])
for i = 0, 1, , n-1,
where a is the amplitude, n is the number of samples,
,
where p = phase[i] modulo 360.0, duty = duty cycle, phase[i] = initial_phase + f*360.0*i, f is the frequency in normalized units of cycles/sample, initial_phase is phase in if reset phase is TRUE, or initial_phase is the phase out from the previous execution of this instance of the Square Wave VI if reset phase is FALSE.
The Square Wave VI is reentrant, so you can use it to simulate a continuous acquisition from a square wave function generator. If the input control reset phase is FALSE, subsequent calls to a specific instance of the Square Wave VI produce the output Square Wave array containing the next samples of a square wave.
Because the Square Wave VI is reentrant, if reset phase is FALSE, the VI uses the phase out value as its new phase in the next time the VI executes.