plot of inverse fourier transform

6 次查看(过去 30 天)
I am trying to plot the inverse fourier transform of a function and I want this plot to be centered at zero. This is the following code that I have:
clear
dx=1;
x=(-45:355)*dx; %'x' position
N=length(x);
ds=(1)/(N*dx);
s=(0:400)*ds; %freq position
h1=normpdf(x,0,2);
HS=abs(fft(h1));
MTF=HS;
M=(1-(1-MTF.^2).^244.9)./(MTF); %function
M1=ifftshift(ifft(M));
plot(x,M1)
I am trying to plot M1 (the inverse fourier transform of my filter, M) vs x. I am converting my filter, M, from frequency space to 'space' space. The problem is when I plot M1 vs x, the function is all the way down at 150 but I want it centered at zero and do not know how to fix it.
Any help will be appreciated
  1 个评论
sixwwwwww
sixwwwwww 2013-10-11
Do you need just simple manipulation of x-axis? mean you just want to shift x = 0 according to the maximum value in Inverse Fourier Transform?

请先登录,再进行评论。

采纳的回答

sixwwwwww
sixwwwwww 2013-10-11
编辑:sixwwwwww 2013-10-11
If you just need shift the x-axis with respect to maximum amplitude position in your Inverse Fourier Transform spectrum then you can do it as follows:
clear
dx=1;
x=(-45:355)*dx; %'x' position
N=length(x);
ds=(1)/(N*dx);
s=(0:400)*ds; %freq position
h1=normpdf(x,0,2);
HS=abs(fft(h1));
MTF=HS;
M=(1-(1-MTF.^2).^244.9)./(MTF); %function
M1=ifftshift(ifft(M));
[Max, Max_ind] = max(M1);
x_shift = Max_ind - abs(min(x));
x = x - x_shift;
plot(x,M1), xlim([min(x) max(x)])
This shift in space domain corresponds to a constant phase multiplication in Frequency domain

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by