fft of two functions multiplied together
13 views (last 30 days)
Show older comments
Hi, I was wondering if anyone could help with a question i have. Im trying to find the value of two functions, say f and g but am trying to do so in fourier space, e.g FFT(f*g) but when i take Ifft the answer is not the same as f*g which i figured it should be, does anyone know why? I have included my test code. Thanks
N=128;
x=((0:N-1)/N)*2*pi;
dx=2*pi/N;
u=sin(x);
v=cos(x);
u_hat=fft(u);
v_hat=fft(v);
ans_hat=((u_hat).*(v_hat));
ans=real(ifftn(ans_hat));
compare=u.*v;
0 Comments
Answers (1)
Matt J
on 14 Jun 2015
Edited: Matt J
on 14 Jun 2015
but am trying to do so in fourier space, e.g FFT(f*g) but when i take Ifft the answer is not the same as f*g
In Fourier space, FFT(f*g) is equivalent to the cyclic convolution of FFT(f) and FFT(g). You haven't done any convolution, but simply the plain element-wise product.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!