time signal to fft and back ifft

13 次查看(过去 30 天)
Atul
Atul 2012-5-2
Hi there
I am using a time series and calculating fft using example provided by MATLAB
L = length(b);
NFFT = 2^nextpow2(L);
y = fft(b, NFFT)/L;
f= Fs/2*linspace(0,1,NFFT/2);
But when i use inverse fourier transform ifft, i do not get real values, i get complex values and the result is not same as the original signal b. I am using y_source = ifft(X,NFFT);
y_source is not same as original signal b.
Could anyone please answer this. Thanks
  2 个评论
Atul
Atul 2012-5-2
I forget to tell that in frequency domain i am muting some y values corresponding to some frequencies, so when i calculate real(ifft(X,NFFT)) i do not get back the signal but if i dont mute those very few values then i recover the signal. The thing is i have muted only 12 values out of more than 1/2 million.
Daniel Shub
Daniel Shub 2012-5-2
You need to be careful that you keep symmetry. You haven't shown us how you "mute" the values.

请先登录,再进行评论。

回答(3 个)

Wayne King
Wayne King 2013-6-4
Note sure why you're dividing by the length of the signal and padding the DFT AND expecting to get the signal back.
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t);
xdft = fft(x);
xhat = ifft(xdft);
max(abs(x-xhat))

ANDRIAMANANTENA Laza
Hello, I have the same problem with my handling and it blocks the rest of my code.
my y signal is
y=sin(2*pi*500*t) with t=linspace(0,5/Fs,5) Fs=44100
When I proceed with fft like
YF= fft(y,NFFT)/length(y)
and try to recover my original signal with
y2=ifft(YF,NFFT,'symmetric')
I don't have the original signal

Atul
Atul 2013-6-5
Wayne: Because here in example given by MATLAB, they have divided the FFT by L, L=length(x) http://www.mathworks.in/help/matlab/ref/fft.html
could you please elaborate if it indeed needs to be divided by length or not and why. In my opinion there is something wrong with Matlab FFT. FFT from matlab does not matches with FFT from say PITSA. So be careful.

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by