Problem with inverse Fourier Transform of a known signal

7 vues (au cours des 30 derniers jours)
Renato D.
Renato D. le 18 Sep 2018
Commenté : Renato D. le 21 Sep 2018
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));

Réponse acceptée

Dimitris Kalogiros
Dimitris Kalogiros le 18 Sep 2018
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.
  5 commentaires
Dimitris Kalogiros
Dimitris Kalogiros le 19 Sep 2018
It is not correct :-(
Here you are an example that explains how to re-generate what missing from your fft :
clear; clc;
close all;
%%time test-signal generation
M=2^12;
t=0:1:2^12-1;
A1=1; f1=0.1;
A2=4; f2=0.01;
A3=1; f3=2^-13;
x=( A1*sin(2*pi*f1.*t)+A2*sin(2*pi*f2.*t) ).*(A3*sin(2*pi*f3*t));
figure('Name', 'original signal & full fft');
subplot(2,2,2); plot( x,'-b'); zoom on; grid on; title('original time signal');
%%fft and ifft
X=fft(x,M); %produce fft
subplot(3,2,1); plot(abs(X),'-k.'); zoom on; grid on; title('abs(fft)');
subplot(3,2,3); plot(real(X),'-b.'); zoom on; grid on; title('real(fft)');
subplot(3,2,5); plot(imag(X),'-r.'); zoom on; grid on; title('imag(fft)');
x1=ifft(X,M); %reconstruct time signa;
subplot(2,2,4); plot( x1,'-r'); zoom on; grid on; title('time signal from ifft');
%%keep right side (positive frequencies)
Y=X(1:M/2);
%%attempt to recover original fft signal
Yr=Y; %right side
Yl=Yr(end:-1:2); %left side
% we can not restore the bin that corresponds to -fs/2
% we regard that it is equal to zero
%(usually it is, since the sampling rate is higher than nyquist rate )
Yl=[0 Yl];
% for real (time)signals, real part of fft is even and imaginary part is even
Yl=conj(Yl);
% construct "double side" fft
Y2=[Yr Yl];
x2=ifft(Y2,M);
figure('Name', 'reconstructed fft and produced time signal');
subplot(2,2,2); plot( x,'-b'); zoom on; grid on; title('original time signal');
subplot(3,2,1); plot(abs(Y2),'-ko'); zoom on; grid on; title('abs(fft)');
subplot(3,2,3); plot(real(Y2),'-bo'); zoom on; grid on; title('real(fft)');
subplot(3,2,5); plot(imag(Y2),'-ro'); zoom on; grid on; title('imag(fft)');
subplot(2,2,4); plot( x2,'-m'); zoom on; grid on; title('time signal from ifft');
Renato D.
Renato D. le 21 Sep 2018
Thank you! I´ll try to aplly this technic on my problem!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by