# What is a “square window function”?

When I read previous studies it mentioned a method of "square windowing function". I searched but I did not find anything talking about it. Can someone help to explain what is "square windowing function"? How to do it in matlab?

The description in the article is like this:

A Cooley-Tukey FFT algorithm was implemented with a square windowing function and a 50% overlap of data segments to reduce spectral variance (Press et al., 1989).

This is from:

Hamill et al., 1995. Shock attenuation and stride frequency during running. Human Movement Science. 14, 45-60.

• I just discovered the meaning of 'boxcar', and have updated the answer (my poor american-english vocabulary) – Laurent Duval Apr 16 '17 at 11:37

A square window seems to be another name for a rectangular window. A rectangular window is the default window used to apply an FFT to a subset of a longer stream of data and without any additional scaling or weighting of any of the subset's samples.

[EDIT] I have just discovered the origin of the name 'boxcar', and cannot resist to the sharing:

a North American railroad car, enclosed, generally used to carry freight.

Basically, they are the same. However, some subtleties follow.

You can check the source by yourself, in a more recent version of Numerical Recipes, chapter Power Spectrum Estimation Using the FFT, page 553:

Data Windowing The purpose of data windowing is to modify equation (13.4.7), which expresses the relation between the spectral estimate $P_k$ at a discrete frequency and the actual underlying continuous spectrum $P(f)$ at nearby frequencies. In general, the spectral power in one "bin" $k$ contains leakage from frequency components that are actually $s$ bins away, where $s$ is the independent variable in equation (13.4.7). There is, as we pointed out, quite substantial leakage even from moderately large values of $s$. When we select a run of $N$ sampled points for periodogram spectral estimation, we are in effect multiplying an infinite run of sampled data $c_j$ by a window function in time, one that is zero except during the total sampling time $N\Delta$, and is unity during that time. In other words, the data are windowed by a square window function.

As said by @hotpaw2, the adjectives boxcar, rectangular or square denote similar windows with zero-value everywhere, except at $N$ consecutive points (discrete), or inside an interval (continuous), where the value is a non-zero constant.

I think that the use of the terms rectangular or square may depend on the context. The square one may denote the template, in both time and frequency continuous domains, of the function having a unit-square shape, being equal to $1$ on the interval of unit-length $[-1/2,1/2]$, whose Fourier transform is the cardinal sine. With the linear/scaling property of the Fourier transform, you can deduce the Fourier transform of the other shapes easily.

I suspect that the name "square"may derive from the periodic version (both continuous or discrete time) that is used for Fourier series or the FFT.

In the discrete time setting, the use might also depend on the exact value of the constant value ($1/N$, $1/\sqrt{N}$), resulting in different FFT normalization, without certainty on my side, just judging from observations.