plot of inverse fourier transform
11 views (last 30 days)
Show older comments
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 Comment
sixwwwwww
on 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?
Accepted Answer
sixwwwwww
on 11 Oct 2013
Edited: sixwwwwww
on 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
0 Comments
More Answers (0)
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!