How to implement ifft?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!