### Background

To gain more insight, we will calculate the Fourier transform of a triangular window using the Fourier transform of a rectangular window. The connection between these two windows helps us to better understand the trade-off involved when you choose between different window functions.

In the first article of this series, we saw that truncation of the impulse response of an ideal filter is equivalent to multiplying the impulse response by a rectangular window. The Fourier transform of the truncated impulse response will exhibit ripples in the pass-band and stop-band. Moreover, the transition band of the achieved filter will be considerably wider than the ideal response.

The second article showed that the main lobe width of a rectangular window determines the width of the filter transition band, whereas the PSL of the window affects the ripples in the pass-band of the filter. It was shown that as we reduce the main lobe width and the PSL, the achieved filter gets closer to the ideal response.

One way to reduce the main lobe width is to increase the number of samples, $$M$$. However, the PSL of a rectangular window is almost independent of $$M$$. Is there any other way to reduce the main lobe width and simultaneously get a smaller PSL? Or a better question: Is there *another window* which can give better performance in terms of main lobe width and PSL? Or at least is there a window which can give a smaller PSL? Because if we can find a window which has, at least, a smaller PSL, we can probably reduce the main lobe width of this specific window by choosing a large $$M$$.

Based on the previous discussion, we will ignore the main lobe width and focus on achieving a smaller PSL than that of a rectangular window.

Consider the normalized Fourier transform of a rectangular window as shown in Figure (1) of the previous article, shown here:

*Figure (1) $$\frac{W(\omega)}{M}$$ for $$M=21$$.*

If we square this spectrum, the peak of the sidelobe, which is less than 1, will decrease compared to the main lobe. Therefore, an unknown window, $$w_{x}[n]$$, whose Fourier transform is equal to the squared of the rectangular window will have a smaller PSL. Multiplying in the frequency domain corresponds to convolution in the time domain. As a result, $$w_{x}[n]$$ must be the convolution of two rectangular windows of the same length, which is a triangular window.

To examine this idea, in the following section, we will calculate the Fourier transform of a triangular (Bartlett) window and we will highlight its connection with the Fourier transform of a rectangular window to gain more insight to the trade-offs.

### The Bartlett Window

The Bartlett window of length 21, $$w_{Bartlett,21}[n]$$, is shown in Figure (2). Unlike the rectangular window, the Bartlett has a smoother transition from zero to one and vice versa.

*Figure (2) The Bartlett window for $$M=21$$.*

In order to calculate the Fourier transform of the Bartlett window, we can consider Figure (2) as the convolution of two rectangular windows of length 11, $$w_{Rectangular, 11}[n]$$.

Of course, we will need to consider a magnitude scaling for these two rectangular windows to have the Bartlett window of Figure (2) after convolving the rectangular windows. In this example, the scaling factor is $$\frac{1}{\sqrt{11}}=0.3015$$. This rectangular window is shown in Figure (3).

*Figure (3) The rectangular window with the appropriate length and height to calculate the Fourier transform of a Bartlett window with $$M=21$$.*

Therefore, we obtain

$$w_{Bartlett,21}[n]=(\frac{1}{\sqrt{11}}w_{Rectangular,11}[n])*(\frac{1}{\sqrt{11}}w_{Rectangular,11}[n])$$

*Equation (1)*

We know that convolution in time domain is equal to multiplication in the frequency domain, hence

$$W_{Bartlett,21}(\omega)=\frac{1}{11}(W_{Rectangular,11}(\omega))^{2}$$

*Equation (2)*

With an odd $$M$$, it can be shown that

$$W_{Bartlett,M}(\omega)=\frac{2}{M+1}(W_{Rectangular,\frac{M+1}{2}}(\omega))^{2}$$

*Equation (3)*

**

where $$W_{Rectangular,M}(\omega)$$ is given by Equation (5) of the previous article as:

$$W_{Rectangular,M}(\omega)=\left\{\begin{matrix} \frac{ sin(\frac{\omega M}{2}) }{sin(\frac{\omega}{2})} & \omega \neq 0\\ M & \omega = 0 \end{matrix}\right \}$$

*Equation (4)*

Equation (3) reveals the most important properties of the Bartlett window:

**Main lobe width of a Bartlett window**: The roots of a Bartlett window of length $$M$$ are the same as the roots of a rectangular window of length $$\frac{M+1}{2}$$ which are at $$\frac{4k\pi}{M+1}$$ where $$k$$ is an integer. Therefore, the main lobe width of a Bartlett window is almost twice the main lobe width of a rectangular window. In other words, since compression in the time domain corresponds to expansion in the frequency domain and any Bartlett is related to a rectangular window of half its length, we expect that the main lobe width of a Bartlett window of length $$M$$ will be twice the main lobe width of a rectangular window of the same length.**The PSL of a Bartlett window**: In order to compare the PSL of a Bartlett with that of a rectangular window, consider the normalized Fourier transform of the rectangular window as shown in Figure (1). In this figure, the magnitude of the first sidelobe is about 0.22 which, considering the normalized magnitude, gives a PSL of $$20log(0.22)\approx -13dB$$. Since the Fourier transform of the Bartlett is equal to the square of the Fourier transform of the rectangular window, the PSL of a Bartlett window will be $$20log(0.22^{2})\approx -26dB$$. Expressed in decibels, the PSL of a Bartlett window is reduced by a factor of 2 relative to that of a rectangular window.

Figure (4) shows the Fourier transform of a Bartlett window with $$M=21$$ which is plotted by MATLAB.

*Figure (4) The magnitude of the Fourier transform of a Bartlett window with $$M=21$$.*

The above discussion shows a trade-off between the main lobe width and PSL. Therefore, we can use a Bartlett window with an appropriate length, $$M$$, to simultaneously reduce the PSL and main lobe width.

At this point, the reader may wonder if there is a window which can provide a better performance than that of a Bartlett in terms of main lobe width and PSL? Is there an optimum or a near-optimum window for a fixed $$M$$?

### Summary

- To reduce the PSL, we can try different window types such as the rectangular, Bartlett, etc.
- Window type and the window length are the two parameters that determine the main lobe width.
- We usually search for a window type which has the acceptable PSL and then choose $$M$$ long enough so that the main lobe width decreases to an acceptable value too.
- The main lobe width of a Bartlett window of length $$M$$ is twice the main lobe width of a rectangular window of the same length.
- Expressed in decibels, the PSL of a Bartlett window is reduced by a factor of 2 relative to that of a rectangular window.

**Next Article in Series: From Filter Specs to Window Parameters in FIR Filter Design**

2 CommentsLoginrubidium2016-06-21Good article, but curious as to why you focused upon the Bartlett taper when there are so many alternatives that may offer better trades between the main lobe width and the peak sidelobe level - depending on the application. Of course there is the seminal paper by Harris (1978) that should be required reading for anybody being introduced to window functions.

Steve Arar2016-06-21Thanks for the comments and also for the reference that you have mentioned.

This article is trying to use the Bartlett window as a tangible example to show how a tapered window reduces the PSL and increases the main lobe width (for a given M). This is shown by comparing the Bartlett with a rectangular window. Usually, textbooks mention that the Gibbs phenomenon can be moderated by the use of a less abrupt truncation, but I was trying to explain it by the relation between the Bartlett and the rectangular window. Insight into the trade-offs was the main goal of the article. So that the reader can remember almost the whole story avoiding math as much as possible.

The other windows and the design procedure will be discussed in the next articles of this series.