# Applying Convolution in Frequency Domain by Element Wise Multiplication on Time Domain

I'm studying the power spectrum.

Right now, I am making a program to try to make sure that the "Fourier transform of the multiplication of some data and window function" and the "convolution of the Fourier transform of some data and window function respectively" match.

$$\mathcal{F}[f(t) w(t)]= F(\omega)*W(\omega)$$

Since the left-hand side is just a Fourier transform, we could easily get the correct result. However, the right hand side is not calculated properly and does not match the result of the left hand side. The beginning and the end of the data are greatly inflated compared to the results obtained from the left side.

The right-hand side of the convolution theorem (which is actually discrete) is an expression like this

$$\int_{0}^{N-1} F\left(\omega^{\prime}\right) W\left(\omega-\omega^{\prime}\right) \mathrm{d} \omega^{\prime}$$.

If we consider the case where $$\omega=0$$, then $$(- \omega ^\prime)$$ will be 0, or negative.

In this case, how should we define $$W(\omega ^\prime)$$ in a case like this?

If $$\omega ^\prime$$= 0, or a negative value, should it be $$W(\omega ^\prime)=0$$ since there is only data between 0 and N-1? (I tried that, but it didn't give me the right result.)

sorry for my bad English, thank you!

It looks like this image.

Blue is the correct form of the left side, and red is the power spectrum obtained from the convolution in the frequency domain of the right side.

Perhaps the integration range of the convolution integral is wrong... • Could what you describe be caused by the Gibbs phenomenon? Dec 22, 2021 at 1:41
• If it is a Gibbs phenomenon, the power spectrum obtained from the left side should have the same shape, but it only looks like the power spectrum obtained from the right side. Dec 22, 2021 at 1:50

If you look at the questions dealing with the other side (Convolution on time domain and element wise multiplication of frequency domain) you'd see that in order to have proper equality one must pay attention to the borders and type of convolution.

For example, have a look at Applying a 2D Convolution Using 2D FFT which aggregates many other answers.

Specifically in your case, assuming the atoms of: FFT Conversion, Convolution and Element Wise Complex Multiplication are implemented correctly you must pay attention to the properties of the DFT.

Just like in links above you must remember that element wise multiplication in the time domain is equivalent of circular convolution in the DFT domain. So one thing to remember is to apply a circular convolution.
The other one is remembering that the FFT is usually not implemented as a unitary transform.
Hence we need to factor $$\mathcal{F} \left[ f \left( t \right) w \left( t \right) \right]$$ by the number of samples.

A simple MATLAB code:

numSamples = 10;
vA = randn(numSamples, 1);
vB = randn(numSamples, 1);

vC = numSamples * fft(vA .* vB);
vCC = cconv(fft(vA), fft(vB), numSamples); %<! Circular convolution

norm(vC - vCC, 1)



The error is 5.1341e-14.

## Update

Just to make things clearer. When dealing with discrete signals in the context of the Convolution Theorem the linear convolution becomes circular / periodic convolution.
Moreover, the convolution theorem works in symmetry, namely element wise multiplication in one domain is equivalent to circular convolution in the other domain (Assuming proportion constants are defined correctly).

• The problem of convolution in the time domain is often talked about, but I don't understand much about convolution in the frequency domain. Is circular convolution effective for convolution in the frequency domain as well? A further question is the consistency with the properties of DFT. Depending on the definition of DFT, when the wavenumber of the resulting Fourier transform is zero, it should simply be a sum of time domain functions. Is this also valid for frequency domain convolution? I.e. $F(0)W(0)+F(1)W(-1)+.... = \Sigma f(t)w(t)$ is valid? (I find this hard to convince myself...) Dec 22, 2021 at 5:42
• When you multiply element wise in one domain it is equivalent, for discrete signals, to circular convolution in the other domain. You may have a look at the code.
– Royi
Dec 22, 2021 at 6:00
• Sorry for the delayed response, thanks for the advice. Dec 22, 2021 at 11:56
• What are the proportion constants you are referring to? Do you mean the numbers in front of the integral when defining the Fourier transform? Dec 23, 2021 at 1:57
• Yes. For instance, in my code, for the classic fft(), it is numSamples.
– Royi
Dec 23, 2021 at 3:37