# Convolution Theorem: Hamming Window on a Time Series and Fourier Domain

If we have a set of time series data, y, consisting of 100 data points. One can apply a N (odd) Hamming window as a weighted moving average to decrease the noise. Say, if we choose 7 point Hamming window, H, [0.0800 0.3100 0.7700 1.0000 0.7700 0.3100 0.0800], and perform a weighted moving average on y. In Matlab, I am doing conv(y, H./sum(H), 'same').

Since this is a convolution, I am wondering that by convolution theorem, one should be able to obtain identical results in Fourier domain, because convolution should become multiplication in the Fourier domain.

However, the FFT of y will have 100 complex numbers, and Hamming window will also have 7 complex numbers. What would be an equivalent operation of a weighted moving average in the Fourier domain?

Thanks.

Fistly, you need to pad the data (y) and the filter (Hamming window). The minimum required length to avoid circular convolution = data length + filter length - 1. In this case, it is 100 + 7 - 1 = 106. For convenient, you may choose power of 2 length, in this case 128.

So, pad the data to 128, do fft on it.

Pad the filter to 128, do fft on it.

Multiply both ffts.

Do ifft.

• Thanks. It works. However there is a minor nuance. Notice that in the Matlab code, conv(y, H./sum(H), 'same'), was used because it is equivalent to a centered moving average. This process keeps the peak position at the identical place. In the Fourier domain, the peak position is moving to the right, which is equivalent to conv(y, H./sum(H)). Is there any trick to avoid that?
– ACR
Commented Jul 18, 2019 at 3:27
• @M.Farooq Just discard the first 3 values, based on the reference. But if you don't want to do that, you may pad the filter as H = {1, 0.77, 0.31, 0.08, ...padding..., 0.08, 0.31, 0.77} Commented Jul 18, 2019 at 6:02
• Discarding the edge points works very well. Just curious, what is the mathematical basis of re-ordering the set of Hamming values before convolution.
– ACR
Commented Jul 18, 2019 at 19:53
• @M.Farooq Shifting 3 points to the left (cyclically) makes the filter zero-phase. Zero-Phase Filters Commented Jul 19, 2019 at 8:21

Convolution Theorem states that " Convolution in the time domain is equivalent to pointwise multiplication in the frequency domain"

In this, you need to pad with zeros for each function for compatible data length