gpt4 book ai didi

matlab - MathNet.Numerics 与 Matlab 前向傅立叶答案不匹配?

转载 作者:太空宇宙 更新时间:2023-11-03 19:59:58 24 4
gpt4 key购买 nike

我有点卡在这里。 MathNet Numerics 的 Forward Fourier 结果似乎比 MATLAB 的结果少了一半。

WindowsPhone 8 上的 MathNet.Numerics

Complex[] samples = { new Complex(5, 0), new Complex(6, 0), new Complex(1, 0), new Complex(2, 0), new Complex(5, 0) };
MathNet.Numerics.IntegralTransforms.Transform.FourierForward(samples);
MathNet.Numerics.IntegralTransforms.Transform.FourierInverse(samples);

原始信号

(5, 0) (6, 0) (1, 0) (2, 0) (5, 0)

正向傅立叶

(8.4970583144992, 4.96506830649455E-16) (2.67082039324994, -0.162459848116454) (-1.32917960675006, -0.688190960235587) (-1.32917960675006, 0.688190960235586) (2.67082039324994, 0.162459848116454)

逆傅立叶

(5, -1.24126707662364E-15) (6, 0) (1, 1.78742459033804E-15) (2, 9.93013661298909E-16) (5, 7.94410929039127E-16)

Matlab FFT 和 IFFT

原始信号

x=[5,6,1,2,5]

前向傅立叶 fft(x)

ans = 19.0000 5.9721 - 0.3633i -2.9721 - 1.5388i -2.9721 + 1.5388i 5.9721 + 0.3633i

逆傅里叶 ifft(ans)

5.0000 6.0000 1.0000 2.0000 5.0000

知道我在这里做错了什么吗?

最佳答案

围绕缩放和指数有多种 FFT 约定。 Math.NET Numerics 使用的默认约定是科学和教育(以及例如 Maple)中通常使用的对称缩放约定。但是,MATLAB 使用非对称缩放。为了获得 MATLAB 的行为和数值结果,添加 FourierOptions.Matlab 作为第二个参数,即

Transform.FourierForward(samples, FourierOptions.Matlab);
Transform.FourierInverse(samples, FourierOptions.Matlab);

关于matlab - MathNet.Numerics 与 Matlab 前向傅立叶答案不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22857775/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com