Rectangular pulse function

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


rectangularPulse(a, b, x)


rectangularPulse(a, b, x) represents the rectangular function.

rectangularPulse(x) is a shortcut for rectangularPulse(-1/2, 1/2, x).

The rectangular function is also called the rectangle function, box function, Pi function, or gate function.

If a and b are variables or expressions with variables, rectangularPulse assumes that a < b. If a and b are numerical values, such that a > b, rectangularPulse throws an error.

If a < x < b, the rectangular pulse function equals 1. If x = a or x = b, the rectangular pulse function equals 1/2. Otherwise, it equals 0. See Example 1 and Example 2.

If a = b, rectangularPulse returns 0. See Example 3.

rectangularPulse(x) is equivalent to rectangularPulse(-1/2, 1/2, x). See Example 4.

rectangularPulse also accepts infinities as its arguments. See Example 7.

rectangularPulse and rectpulse are equivalent.


Example 1

Compute the rectangular pulse function for these input arguments:

[rectangularPulse(-1, 1, -2), rectangularPulse(-1, 1, -1),
rectangularPulse(-1, 1, 0), rectangularPulse(-1, 1, 1),
rectangularPulse(-1, 1, 2)]

Example 2

If a < b, the rectangular pulse function for x = a and x = b equals 1/2:

assume(a < b);
[rectangularPulse(a, b, a), rectangularPulse(a, b, b)]

Example 3

For a = b, the rectangular pulse function returns 0:

rectangularPulse(a, a, x)

Example 4

Use rectangularPulse with one input argument as a shortcut for computing rectangularPulse(-1/2, 1/2, x):


[rectangularPulse(-1), rectangularPulse(-1/2), rectangularPulse(0),
rectangularPulse(1/2), rectangularPulse(1)]

Example 5

Rewrite the rectangular pulse function in terms of the Heaviside step function:

rewrite(rectangularPulse(a, b, x), heaviside)

Example 6

Plot the rectangular pulse function:

plot(rectangularPulse(x), x = -1..1)

Example 7

Plot the rectangular pulse function for which the argument b is a positive infinity:

plot(rectangularPulse(0, infinity, x))


a, b, x

Arithmetical expressions.

Return Values

Arithmetical expression.

Overloaded By


See Also

MuPAD Functions

Was this topic helpful?