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/5figure;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/2figure;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 onplot(xcut38,h38,'--r','linewidth',2,'markersize',14);
Best Answer