Signal Toolkit - square


Function File: s = square (t, duty)
Function File: s = square (t)

Generate a square wave of period 2 pi with limits +1/-1.

If duty is specified, it is the percentage of time the square wave is "on". The square wave is +1 for that portion of the time.

                   on time * 100
    duty cycle = ------------------
                 on time + off time
 

See also: cos, sawtooth, sin, tripuls.