The rectangular window is defined as a constant value of 1 over the entire window length and a value of 0 outside the window.
$
w(n) =
\begin{cases}
1 & 0 \leq n \lt M \\
0 &\text{otherwise} \\
\end{cases}\\
$
It can also be expressed in terms of the [[discrete-time unit-step]]:
$
w(n) = u(n) - u(n-M)
$
![[Window_function_and_frequency_response_-_Rectangular.svg]]
[Wikimedia](https://en.wikipedia.org/wiki/File:Window_function_and_frequency_response_-_Rectangular.svg)