# MATLAB: Problem with inverse Fourier Transform of a known signal

inverse fourier transformsystem identification

Hello,
I am currently working on a identification problem in which I have to perform an inverse fourier transform of a frequency domain signal in order to identify it's poles with an Matrix Pencil algorithm. I´m having trouble with the inverse transformation part. I´ve used the matlab ifft function an also the discrete inverse fourier formula, but none of them seem to give the correct response in time domain. I have an example with both the frequency and time domain signal, and when I try to reproduce that, they have some amplitude missmatch and also, the reproduced signal does not start or go to zero, as it should be. Can anyone please help me understand what am I doing wrong? I´m attaching the data and also my code.
 dt=1/(max(f)); %time sampleN2=length(f);t1 = 0:dt:(N2-1)*dt;% Inverse fourier - Formulay=zeros(1,N2); Sum=0; for k=1:N2     for jj=1:N2         Sum=Sum+Y(jj)*exp(j*f(jj)*t1(k));      end y(k)=Sum; Sum=0;% Reset endy=y/N2;y2=ifft(Y); %Matlab functionfigureplot(t1,sinal);figureplot(t1,real(y));figureplot(t1,real(y2));