The rect command takes an identifier or an expression x and returns the value of the rectangle function at x , which is defined by Π(x)=u(x+1/2)−u(x−1/2) where u is the Heaviside function. The rectangle function is a special case of boxcar function (see Section 5.27.1) for a=−1/2 and b=1/2 .
For example, input :
Output :
To compute the convolution of the rectangle function with itself, use the convolution theorem. Input :
Output :
The above result is the triangle function tri(x) (see Section 5.27.3).