Signal Processing Toolbox    
square

Generate a square wave.

Syntax

Description

x = square(t) generates a square wave with period 2 for the elements of time vector t. square(t) is similar to sin(t), but creates a square wave with peaks of ±1 instead of a sine wave.

x = square(t,duty) generates a square wave with specified duty cycle, duty. The duty cycle is the percent of the period in which the signal is positive.

See Also
chirp
Generate a swept-frequency cosine.
cos
Compute the cosine of vector/matrix elements (see the MATLAB documentation).
diric
Compute the Dirichlet or periodic sinc function.
gauspuls
Generate a Gaussian-modulated sinusoidal pulse.
pulstran
Generate a Pulse train.
rectpuls
Generate a sampled aperiodic rectangle.
sawtooth
Generate a sawtooth or triangle wave.
sin
Compute the sine of vector/matrix elements (see the MATLAB documentation).
sinc
Compute the sinc or sin(t)/t function.
tripuls
Generate a sampled aperiodic triangle.


 sptool ss2sos