简体   繁体   English

与MATLAB逆FFT不起作用

[英]inverse fft with matlab not working

I am trying to do an inverse FFT in Matlab, but I can't seem to get the inverse working correctly. 我正在尝试在Matlab中进行逆FFT,但似乎无法正确执行逆运算。 Here is my code: 这是我的代码:

    data = [-0.0005
       -0.0004
       -0.0003
       -0.0002
       -0.0001
       -0.0000
        0.0001
        0.0001
        0.0001
        0.0002
        0.0002
        0.0002
        0.0002
        0.0002
        0.0002
        0.0002
        0.0002
        0.0002
        0.0003
        0.0004
        0.0005
        0.0006
        0.0007
        0.0009
        0.0010
        0.0011
        0.0011
        0.0012
        0.0011
        0.0011
        0.0011
        0.0010 ];    


%plot data
figure(1)
plot(data)    

%FFT
N = 100;
X = fft(data, N);
F = [-N/2:N/2-1]/N;
F = F/0.0125;

X = fftshift(X);
figure(2)
plot(F, abs( X ) )

%inverse FFT
y = ifft(X);
figure(3)
plot(F,y)

Figure 1 and 3 should be identical, but are not in any way. 图1和图3应该相同,但绝非相同。 I made sure not to take ifft of the absolute value of fft , so it's not clear to me what is wrong. 我确保不要将fft的绝对值取为ifft ,所以我不清楚什么是错误的。

由于使用fftshift移位了频谱,因此在进行傅立叶逆变换之前,必须先“消除”频谱

y = ifft(fftshift(X));

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

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