How do I have to normalize fft and ifft when I am using the convolution theorem?
24 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!