Problem Resolved... Essentially, the length of the results need padding. Cannot get away with the increased length of vectors. Have to truncate it manually.
FFT'ed two gaussian functions then multiplied them together then ifft'ed the result, but I got something that is completely out of whack... Why?
1 view (last 30 days)
Show older comments
The following code is what I ran. Essentially I created 2 gaussian functions then moved them both into frequency domain via fft and then multiplied them together in frequency domain. I then ifft the result hoping to see something that looks like a "blurred" Gaussian. However, instead what I get is the monstrosity in the blue curve in figure(1)... I don't understand why is the blue curve anything but what I expected. Any help is much appreciated.
if true
close all;
clear all;
clc;
col=1000;
sx=(col+1)/2;
k=50;
a=1000/k;
x=1:1:1000;
t=exp(-5*(x-sx).^2/a^2);
t=t/sum(sum(t));
T=fft(t);
b=100;
f=exp(-5*(x-sx).^2/b^2);
F=fft(f);
O=F.*T;
tt=ifft(T);
ft=ifft(F);
ot=ifft(O);
figure(1)
plot(x,tt,'r',x,ft,'g',x,ot,'b');
figure(2)
plot(x,abs(T),'r',x,abs(F),'g',x,abs(O),'b');
figure(3)
plot(x,angle(T),'r',x,angle(F),'g',x,angle(O),'b');
end
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!