How do you code a square wave?
Description. x = square( t ) generates a square wave with period 2π for the elements of the time array t . square is similar to the sine function but creates a square wave with values of –1 and 1. x = square( t , duty ) generates a square wave with specified duty cycle duty .
What is the function of a square wave?
The square wave, also called a pulse train, or pulse wave, is a periodic waveform consisting of instantaneous transitions between two levels. The square wave is sometimes also called the Rademacher function.