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 sample
N2=length(f);
t1 = 0:dt:(N2-1)*dt;
% Inverse fourier - Formula
y=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
end
y=y/N2;
y2=ifft(Y); %Matlab function
figure
plot(t1,sinal);
figure
plot(t1,real(y));
figure
plot(t1,real(y2));

Best Answer

Allow me to make an observation: when you perform ifft() upon signal Y in order to get time signal y2, it seems that Y is an "one-sided" FFT of some time signal (...which, I suppose is the signal "sinal" ).
This for sure something is something wrong. When you perform ifft() , the output should be in the form that fft() had generated it.