Wave Walker DSP

DSP Algorithms for RF Systems


Buy the Book!

DSP for Beginners: Simple Explanations for Complex Numbers! The second edition includes a new chapter on complex sinusoids.

Windowing Functions for Better Spectral Analysis
August 1, 2023

Table of Contents


The Discrete Time Fourier (DFT) and Fast Fourier Transform (FFT) are incredible tools for spectral analysis. Read on to find out why a windowing function can dramatically improve their performance even further.

More DSP blogs!

Windowing Functions for the DFT

The DFT is an incredible tool for spectral analysis. But like all tools, it needs to be used properly and can benefit from an upgrade. A windowing function comes at the cost of additional computation but greatly improves the overall performance.

The DFT assumes the input time-series is periodic [oppenheim1999, p. 542]. such that the signal wraps from the last sample to the first input sample. Large transitions from the last sample input sample to the first input sample will result the creation of wideband spectral noise which degrades the quality of the resulting frequency analysis.

However, most signals will not be perfectly periodic when computing the DFT and this is where the windowing function becomes useful. Windowing functions drive the beginning and end of the input time-series to zero. Windowing suppresses transitions on the boundaries of the input signal thereby reducing any wideband spectral noise that would have been created otherwise.

Figure 1 shows the time-domain response of a Bartlett window, defined as w[n].

Figure 1: Time domain of the Bartlett window.
Figure 1: Time domain of the Bartlett window.

A sinusoid with frequency f_0 = 0.05,

(1)   \begin{equation*}x[n] = e^{j2\pi f_0 n}\end{equation*}

is plotted in Figure 2, along with a windowed version x[n]w[n] of the sinusoid. Notice how the sinusoid x[n] without the window is not perfectly periodic, such that the last sample at time n=255 does not flow smoothly into the beginning sample at time n = 0. Figure 2 shows how a windowing function drives the beginning and ending samples to zero.

Figure 2: A sinusoid with and without a Bartlett windowing function.
Figure 2: A sinusoid with and without a Bartlett windowing function.

Frequency Domain Analysis

Figure 3 gives the magnitude of the frequency response of the sinusoid x[n] with and without the Bartlett window. The sidelobes are substantially lower! The smallest sidelobes without a window approach -50 dB, and applying a window reduces them to -90 dB!

What’s the benefit?

The first benefit is the reduction in sidelobes reduces the amount of energy content at other frequencies which improves the overall accuracy of the spectral estimate. Recall that the DFT of an infinitely complex sinusoid is an impulse function in the frequency domain, meaning it has energy at a single frequency. However, the unwindowed spectral estimate in Figure 3 shows energy distributed across the entire bandwidth. Compare against the windowed version which has a higher proportion of it’s energy located around the frequency of the sinusoid, a more accurate spectral estimate.

The second benefit is the ability to resolve lower power signals. Using the unwindowed spectral response, signals which have a peak lower than -40 dB would not be able to be seen. However, the Bartlett window creates another 50 dB worth of dynamic range in the spectral estimate.

Figure 3: The sidelobes with the Bartlett window are dramatically reduced.
Figure 3: The sidelobes with the Bartlett window are dramatically reduced.

Figure 4 zooms in around the peak of the frequency response. The largest sidelobe without windowing is – 13 dB, and applying a window reduces that to -26 dB. However, the reduction in sidelobes does come at the cost of smearing the the frequency response as seen in the increased width of the main lobe.

Figure 4: A windowing function trades smearing and widening the peak with reducing sidelobes.
Figure 4: A windowing function trades smearing and widening the peak with reducing sidelobes.

The last trade-off is the increase in computation: implementing a windowing function requires a element-by-element multiply of the windowing function with the input signal, x[n]w[n]. However, this is almost always a worthwhile trade.


A windowing function sends the beginning and ending samples of time-series into zero, forcing non-periodic signals approximate a periodic function. Examples how how the Bartlett window improves the spectral estimate of a sinusoid by reducing the sidelobes by 50 dB over the unwindowed estimate. However, the trade-off is the widening of the main-lobe and the computational cost to implement the multiplies.

More DSP blogs!

Leave a Reply

God, the Lord, is my strength; He makes my feet like the deer's; He makes me tread on my high places. Habakkuk 3:19
For everything there is a season, and a time for every matter under heaven. A time to cast away stones, and a time to gather stones together. A time to embrace, and a time to refrain from embracing. Ecclesiastes 3:1,5
The earth was without form and void, and darkness was over the face of the deep. And the Spirit of God was hovering over the face of the waters. Genesis 1:2
Behold, I am toward God as you are; I too was pinched off from a piece of clay. Job 33:6
Enter His gates with thanksgiving, and His courts with praise! Give thanks to Him; bless His name! Psalm 100:4
Lift up your hands to the holy place and bless the Lord! Psalm 134:2
Blessed is the man who trusts in the Lord, whose trust is the Lord. He is like a tree planted by water, that sends out its roots by the stream, and does not fear when heat comes, for its leaves remain green, and is not anxious in the year of drought, for it does not cease to bear fruit. Jeremiah 17:7-8
He said to him, “You shall love the Lord your God with all your heart and with all your soul and with all your mind. This is the great and first commandment. And a second is like it: You shall love your neighbor as yourself. On these two commandments depend all the Law and the Prophets.” Matthew 22:37-39
Then He said to me, “Prophesy over these bones, and say to them, O dry bones, hear the word of the Lord. Thus says the Lord God to these bones: Behold, I will cause breath to enter you, and you shall live." Ezekiel 37:4-5
Riches do not profit in the day of wrath, but righteousness delivers from death. Proverbs 11:4
The angel of the Lord appeared to him in a flame of fire out of the midst of a bush. He looked, and behold, the bush was burning, yet it was not consumed. And Moses said, “I will turn aside to see this great sight, why the bush is not burned.” When the Lord saw that he turned aside to see, God called to him out of the bush, “Moses, Moses!” And he said, “Here I am.” Exodus 3:2-3
Daniel answered and said: “Blessed be the name of God forever and ever, to whom belong wisdom and might. He changes times and seasons; He removes kings and sets up kings; He gives wisdom to the wise and knowledge to those who have understanding." Daniel 2:20-21
Previous slide
Next slide

This website participates in the Amazon Associates program. As an Amazon Associate I earn from qualifying purchases.

© 2021-2024 Wave Walker DSP