简体   繁体   English

MATLAB 中的快速傅立叶逆变换

[英]Inverse fast fourier transform in MATLAB

My MATLAB code for fft and ifft below has a problem with the inverse Fourier signal y not matching the in put signal x .我下面用于fftifft MATLAB 代码存在逆傅立叶信号y与输入信号x不匹配的问题。 Is there any solution to resolve this?有没有办法解决这个问题?

N = 1000;
t0 = 1e-13;
tau = 2*1e-14;
n = [0:t0/40:2*1e-13-t0/40];
f0 = 3*1e8/(150*1e-9);

x = cos(2*pi*f0*n);
x = x.*exp((-(n-t0).^2)./(tau^2));
X = abs(fft(x,N));
F = [-N/2 : N/2 - 1]/N;
X = fftshift(X);
y=ifft(X,80);

figure(3)
plot(n,y)

I see a number of issues here:我在这里看到了一些问题:

N = 1000;
t0 = 1e-13;
tau = 2*1e-14;
n = [0:t0/40:2*1e-13-t0/40];
f0 = 3*1e8/(150*1e-9);

x = cos(2*pi*f0*n);
x = x.*exp((-(n-t0).^2)./(tau^2));
%  X = abs(fft(x,N));  <-- Not seen this technique before, and why N=1000?
% try something more like:
X = fft(x);

F = [-N/2 : N/2 - 1]/N;
% this is fine to shift and plot the function
Xshifted = fftshift(X);
plot( abs( Xshifted ) )
% now you're taking the inverse of the shifted function, not what you want
% y=ifft(X,80);  also not sure about the 80
y = ifft(X);

figure(3)
plot(n,y)
figure(4)
plot( n, x ); hold on; plot( n, y, 'o' )

脚本输出

That's all I see at first.这就是我最初看到的。 HTH!哼!

If you take the absolute value of the fft, you destroy the phase information needed to reconstruct the original signal, ie the moment you compute如果取 fft 的绝对值,则会破坏重建原始信号所需的相位信息,即计算的那一刻

X = abs(fft(x,N));

You cannot go back via ifft, because now you only have the magnitude.你不能通过 ifft 返回,因为现在你只有大小。 Also, the inverse transformation only works if you use the same number of FFT bins with NFFT>=length(x).此外,逆变换仅适用于使用相同数量的 NFFT>=length(x) 的 FFT 箱。

y=ifft(fft(x)); 

should be exactly the same as x.应该与 x 完全相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM