How to implement ifft?

6 views (last 30 days)
bazrafshan88@gmail.com
bazrafshan88@gmail.com on 15 Jul 2015
Dear all
I have been having a big problem understanding the concept of numerical ifft. Consider a function in spatial domain like f(x)=-2/pi*Ln(abs(x)) for -Lx<x<Lx. The fourier transform of this function is F(w)=2/abs(w). I want to figure out whether these two are numerically the same using ifft command in Matlab. If you run the simple code below, you will see the difference that bothers me:
clc
clear all
Lx=0.0005;
N=pow2(10);
dx=2*Lx/(N-1);
w=pi/(N*dx)*linspace(-N/2,N/2,N);
Hw=2./abs(w);
hx=1/dx*abs(fftshift(ifft(Hw)));
x=linspace(-Lx,Lx,N);
hxexact=-2/pi.*log(abs(x));
plot(x,hx,x,hxexact,'r')
legend('ifft','exact')
I would appreciate that if anyone could help me with this.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!