MATLAB Answers


How do I have to normalize fft and ifft when I am using the convolution theorem?

Asked by Matthias
on 17 Sep 2013
Accepted Answer by Matt J

I would like to calculate a convolution of a density profile rho(x) and a weight function w(x), to get the weighted density. the density is basicly a heavyside function that starts to be nonzero at z = sigma. and the weight function is of the form pi/8*(sigma^2-z^2).

To calculate the convolution I wanted to use the convolution theorem:

w * rho = ifft( fft(w) . fft(rho) )

So I initialized the two function by two vectors and calculated the convolution of the two in the way discribed above. Unfortunatly the result has the right shape, but doesn't have the same hight as my analytic result. I have been reading about the normalization of fft and ifft, but couldn't figure out how I had to normalize my fft and ifft vectors.

Thank you very much for your help.

I have the following code:

if true
sigma = 0.24*10^(-10);
eta = 0.05;
rho0 = eta*6/(pi*sigma^3);
y = linspace(-sigma,0,100);
x = linspace(0,3*sigma,300);
rho = [zeros(1,100) rho0*ones(1,100) zeros(1,100)];
w = [pi/8*(sigma^2-x(1:100).^2) zeros(1,100) pi/8*(sigma^2-y(1:100).^2)];
frho = fft(rho);
fw = fft(w);
n = ifft(fw.*frho);



No products are associated with this question.

1 Answer

Answer by Matt J
on 17 Sep 2013
Edited by Matt J
on 17 Sep 2013
 Accepted answer

The convolution you've done is a discrete sum. To make a sum approximate an integral, you must multiply it by the interval dx at which rho(x) and weight(x) were sampled.

  1 Comment

on 19 Sep 2013

thank you, that was helpful

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!