scipy.signal.square

scipy.signal.square(t, duty=0.5)[source]

Return a periodic square-wave waveform.

The square wave has a period 2*pi, has value +1 from 0 to 2*pi*duty and -1 from 2*pi*duty to 2*pi. duty must be in the interval [0,1].

Parameters :

t : array_like

The input time array.

duty : float, optional

Duty cycle. Default is 0.5 (50% duty cycle)

Returns :

y : ndarray

Output array containing the square waveform.

Examples

Previous topic

scipy.signal.sawtooth

Next topic

scipy.signal.sweep_poly