How to Take Inverse Fourier Transform?

4 次查看(过去 30 天)
Hi,
I am trying to take inverse Fourier transform of the Fourier transform of a step profile. Attached is my code and the data.
I have duplicated the step profile in order to avoid spectral leakege. If I take Fourier transferom of this step and then inverse Fourier transform. The inverse Fourier tansform shoud recover my orginal signal, but this is not the case in my code. I am not sure what is wrong in my code. Any help or suggestion would be appericated.
clc;
clear all;
close all;
% Loading Files
hfit_38=load('P:\pCloud Sync\Swati\Swati_mac\MATLAB\ITF_diff_pos\38_ITF\hfit38_1');
x_38=load('P:\pCloud Sync\Swati\Swati_mac\MATLAB\ITF_diff_pos\38_ITF\xavg38_1');
figure;
plot(x_38.xavg,hfit_38.hfit,'.-k','linewidth',2,'markersize',14);
%% generate double-sided step
hfit38=hfit_38.hfit;
dhfit=diff(hfit38);%./diff(x_38.xavg);
dx=[0:length(dhfit)-1]*0.16/5
figure;
plot(dx,dhfit,'.-', 'linewidth',1.5, 'markersize',12);
set(gca, 'FontName', 'Arial');
set(gca, 'FontSize', 24);
xlabel('x-pixel'); ylabel('dz/dx '); axis square;
[pkfit,locfit] = findpeaks(dhfit,'MinPeakHeight',0.18);
%%
L1=213;
w1=21;
hcutfit38=hfit38(locfit-L1:locfit+L1);
hcutfit38(1:L1-w1)=hcutfit38(L1-w1)+(hcutfit38(1:L1-w1)-hcutfit38(L1-w1))*0;
hcutfit38(L1+w1:end)=hcutfit38(L1+w1)+(hcutfit38(L1+w1:end)-hcutfit38(L1+w1))*0;
hcutfit38=hcutfit38-hcutfit38(1);%h4-h4(1)
hcutfit38=hcutfit38/(hcutfit38(end)-hcutfit38(1));
h38=[hcutfit38,hcutfit38(end-1:-1:1)];
[pk,loc] = findpeaks(diff(hcutfit38),'MinPeakHeight',0.18);
xcut38=[0:length(h38)-1]*0.16/5;
figure;
plot(xcut38,h38,'.-r','linewidth',2,'markersize',14);
%% FFT of measured step
Y1 = fftshift(fft(h38));
Y1 = abs(Y1);
Lm=numel(Y1);
P1 = Y1;
Fs=1000/(160/5);
f1=-Fs/2:Fs/Lm:Fs/2
figure;
plot(P1,'-.k');
set(gca, 'FontName', 'Arial');
set(gca, 'FontSize', 24);
%%
N=length(P1);
sig=ifftshift(abs(ifft(P1)));
figure;
plot(xcut38,sig,'o-k');
hold on
plot(xcut38,h38,'--r','linewidth',2,'markersize',14);

采纳的回答

Daniel M
Daniel M 2019-11-3
编辑:Daniel M 2019-11-3
You have essentially done this:
Y1 = fftshift(fft(h38));
Y1 = abs(Y1);
P1 = Y1;
iP1 = ifft(P1);
Of course iP1 will not resemble the original signal. You have taken the inverse transform of only the magnitude of the signal, therefore removing all the phase information that was stored in the complex plane. You need to take the inverse of the full, complex signal.
The fft of a signal stores the amplitude of the frequencies in the real part and the phase in the imaginary part. Without the phase information, you have no idea how those frequencies combine in time, so it is assumed they are start with a phase of zero at time equals zero.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by