【问题标题】:Decrete Fourier Transform in MatlabMatlab中的离散傅里叶变换
【发布时间】:2012-04-27 01:44:33
【问题描述】:

我被要求在 matlab 中编写一个 fft 混合基数,但在此之前,我想让以直接的方式进行离散傅立叶变换。所以我决定按照维基百科定义的公式来写代码。

[抱歉,我还不能发布图片]

http://en.wikipedia.org/wiki/Discrete_Fourier_transform

所以我写了如下代码:

%Brutal Force Descrete Fourier Trnasform
function [] = dft(X)

%Get the size of A
NN=size(X);
N=NN(2);
%====================

%Declaring an array to store the output variable
 Y = zeros (1, N)
%=========================================



for k = 0 : (N-1)
    st = 0; %the dummy in the summation is zero before we add
    for n = 0 : (N-1)
        t = X(n+1)*exp(-1i*2*pi*k*n/N);
        st = st + t;
    end
    Y(k+1) = st;
end
Y
%=============================================

但是,我的代码输出的结果似乎与本网站的结果不同: http://www.random-science-tools.com/maths/FFT.htm

您能帮我找出问题所在吗?

谢谢!

============ 没关系,我的代码似乎是正确的......

【问题讨论】:

    标签: matlab fft dft


    【解决方案1】:

    默认情况下,Web 链接中的计算器会在执行 FFT 之前将窗口函数应用于数据。这可能是造成差异的原因吗?您可以从下拉菜单中关闭窗口。

    顺便说一句,Matlab 中有一个 FFT 函数

    【讨论】:

      猜你喜欢
      • 2018-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多