fft - How to implement ifft in matlab? -


i have been having big problem understanding concept of numerical ifft.

consider function in spatial domain f(x)=-2/pi*ln(abs(x)) in x between -lx , lx. fourier transform of function f(w)=2/abs(w).

i want figure out whether these 2 numerically same using ifft command in matlab. if run simple code below, see difference bothers me:

  clc    clear    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') 

here output:

i appreciate if me this.

you seem have confusion fft function, result might have been looking is:

sqrt(2./pi) / w 

this fft of function iff w positive!

this fft in general case:

this fft in general case

if use matlab's fft function instead of using own 2./abs(w) see ifft , original function align.


Comments