Main Content


Rectangular window



w = rectwin(L) returns a rectangular window of length L.


collapse all

Create a 64-point rectangular window. Display the result using wvtool.

L = 64;

{"String":"Figure Window Visualization Tool contains 2 axes objects and other objects of type uimenu, uitoolbar, uipanel. Axes object 1 with title Time domain contains an object of type line. Axes object 2 with title Frequency domain contains an object of type line.","Tex":["Time domain","Frequency domain"],"LaTex":[]}

Input Arguments

collapse all

Window length, specified as a positive integer.

Data Types: single | double

Output Arguments

collapse all

Rectangular window, returned as a column vector.


The output of the rectwin function with input L can also be created using the ones function.

w = ones(L,1);


[1] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a