IFFT usage from a frequency signal to a time domain

4 views (last 30 days)
Hi,
I know that there are a lot of questions about this function, but I have not found an answer that can fit to me.
I have a signal in frequency domain. I have N=2001 samples, the maximum frequency of interest is f_max=10 GHz. I have also the corresponding signal in time domain.
What I want is
  • to check if, performing the ifft of my frequency signal, I get a signal equal to my original time domain one.
  • to perform the fft transform again, in order to check if I get back my original frequency signal.
Nor ifft neither fft show me the results I expect.
My signal is stored in a 3D matrix.
I am doing like :
for i=1:row
for j=1:row
Fs=2*max(freq); %sampling frequency
Ts=1/Fs; %time sampling
dF=freq(2)-freq(1);
x_aux(i,j,:)=[squeeze(X(i,j,:))' fliplr(conj(squeeze(X(i,j,2:end-1))))'];
nfft=2^nextpow2(Laux);
x_ifft1(i,j,:)=real(ifft(x_aux(i,j,:),nfft))*Laux*dF;
x_ifft(i,j,:)=x_ifft1(i,j,1:Laux);
t_ifft=(0:Laux-1)*Ts;%/Laux;
Lifft=length(x_ifft1(i,j,:));
NFFT=2^nextpow2(Lifft);
dt=t_ifft(2)-t_ifft(1);
fs=1/dt;
time_window=t_ifft(end)-t_ifft(1);
ncampt=size(t_ifft,2);
X_FFT1(i,j,:)=fft(x_ifft1(i,j,:),NFFT)*(dt/Lifft);
X_FFT(i,j,:)=(X_FFT1(i,j,1:1+ncampt/2));
f_fft=(0:ncampt/2)*(1/time_window);
end
end
Can somebody explain what is wrong in this code?
Best

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!