【问题标题】:fft matlab time to freq and backfft matlab time to freq and back
【发布时间】:2018-01-05 00:27:06
【问题描述】:

我正在尝试一个简单的(快速傅立叶变换)fft 并将其转换回来,但它不起作用。 我需要从这个开始,以便继续为每个组件添加阶段。你能看看我哪里错了吗?

fun_cos=@(t) cos(1.5e12*t)
nttf=2^17;
t=linspace(-3*t_signal_pulse/2,3*t_signal_pulse/2,nttf);
dni_ni=(1/(t(2)-t(1)));
ni=-dni_ni/2:dni_ni/(nttf):dni_ni/2-dni_ni/(nttf);
w=ni.*2*pi;
figure(1)
plot(t,fun_cos(t))
FFt_cos=fftshift(fft(fun_cos(t),nttf))/length(t);
figure(2);
plot(w,abs(FFt_cos))
fft_back=ifft(ifftshift(FFt_cos));
figure(1)
hold on
plot(t,abs(fft_back),'.r')

Freq domain. you can see here two freq even though I only need one

Final result. The blue is the original cosine and the red is the one that I would expected to be the same

另外,如果我想分别将相位添加到时域和频域(请注意,我只知道频域相位的一侧,而不是两者,所以还不知道如何进行此操作)

【问题讨论】:

  • 请提供minimal reproducible example 并且包括结果可能有用。
  • 刚刚添加了一张带有结果的照片。蓝色是原始功能。红色是我认为会相同的那个,但正如你所知,它不是

标签: matlab fft ifft phase


【解决方案1】:

您忘记使用 'length(t)' 重新缩放:

fft_back=ifft(ifftshift(FFt_cos*length(t)));

MaxError=max(abs(fun_cos(t)-fft_back)) %reconstruction error

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-27
    • 1970-01-01
    • 2022-12-19
    • 1970-01-01
    • 1970-01-01
    • 2011-08-09
    • 1970-01-01
    相关资源
    最近更新 更多