rectpuls

Generate a sampled rectangular pulse centered at zero, with a specified width.

Syntax

p = rectpuls(t)

p = rectpuls(t, w)

Inputs

t
The times at which to generate the signal.
Dimension: vector
w
The pulse width. (default: 1)
Dimension: scalar

Outputs

p
The rectangular pulse.

Example

Plot a pulse of width 2, centered at t=3 on a 10 second interval, sampled at 100 Hz.

t = [0:0.01:10];
p = rectpuls(t - 3, 2);
plot(t, p);
xlabel ('Time (sec)');
ylabel ('Amplitude');


Figure 1. rectpuls figure 1

Comments

rectpuls is commonly used as an input to pulstran.