Owning Class: waveform generation
Requires: MathScript RT Module
s = square(t)
s = square(t, d)
Generates a square wave with period 2*pi.
| Name | Description |
|---|---|
| t | Specifies the times at which to plot data for the square wave. t is a vector. |
| d | Specifies the duty cycle percentage of the square wave, or the percentage of high data in the square wave. d is a scalar between 0 and 100. The default is 50. |
| Name | Description |
|---|---|
| s | Returns the square wave at times t with period 2*pi and duty cycle d. s is a vector. |
X = 0:0.01:6*pi;
Y = square(X, 30);
plot(X, Y)