Asked by Matthias
on 17 Sep 2013

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); plot(x,n);

end

*No products are associated with this question.*

Opportunities for recent engineering grads.

## 0 Comments