def drect(n,N):
x = np.zeros(len(n))<EOL>for k,nn in enumerate(n):<EOL><INDENT>if nn >= <NUM_LIT:0> and nn < N:<EOL><INDENT>x[k] = <NUM_LIT:1.0><EOL><DEDENT><DEDENT>return x<EOL>
Discrete rectangle function of duration N samples.

The signal is active on the interval 0 <= n <= N-1. Also known
as the rectangular window function, which is available in 
scipy.signal.

Parameters
----------
n : ndarray of the time axis
N : the pulse duration

Returns
-------
x : ndarray of the signal

Notes
-----
The discrete rectangle turns on at n = 0, off at n = N-1 and 
has duration of exactly N samples.

Examples
--------
>>> import matplotlib.pyplot as plt
>>> from numpy import arange
>>> from sk_dsp_comm.sigsys import drect
>>> n = arange(-5,5)
>>> x = drect(n, N=3)
>>> plt.stem(n,x)
>>> plt.show()

Shift the delta left by 2.

>>> x = drect(n+2, N=3)
>>> plt.stem(n,x)