plot of inverse fourier transform

6 vues (au cours des 30 derniers jours)
richard
richard le 11 Oct 2013
Modifié(e) : sixwwwwww le 11 Oct 2013
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 commentaire
sixwwwwww
sixwwwwww le 11 Oct 2013
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?

Connectez-vous pour commenter.

Réponse acceptée

sixwwwwww
sixwwwwww le 11 Oct 2013
Modifié(e) : sixwwwwww le 11 Oct 2013
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

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by