到底如何计算快速傅立叶变换?

发布于 2024-09-08 20:53:32 字数 215 浏览 0 评论 0原文

我已经阅读了很多有关快速傅里叶变换的内容,并试图了解它的低级方面。不幸的是,谷歌和维基百科根本没有多大帮助……而且我打开了大约 5 本不同的算法书籍,它们也没有多大帮助。

我试图找到像矢量 [1,0,0,0] 这样简单的东西的 FFT。当然,我可以将其插入 Matlab,但这无助于我了解底层发生的情况。另外,当我说我想求一个向量的 FFT 时,这是否等同于说我想用更有效的算法求一个向量的 DFT?

I've been reading a lot about Fast Fourier Transform and am trying to understand the low-level aspect of it. Unfortunately, Google and Wikipedia are not helping much at all.. and I have like 5 different algorithm books open that aren't helping much either.

I'm trying to find the FFT of something simple like a vector [1,0,0,0]. Sure I could just plug it into Matlab but that won't help me understand what's going on underneath. Also, when I say I want to find the FFT of a vector, is that the same as saying I want to find the DFT of a vector just with a more efficient algorithm?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

高速公鹿 2024-09-15 20:53:32

你是对的,“快速傅里叶变换”只是任何在 O(n log n) 时间内计算离散傅里叶变换的算法的名称,并且有多种这样的算法。

这是我认为的 DFT 和 FFT 最简单的解释,还有小 N 的示例,可能会有所帮助。 (请注意,存在替代解释和其他算法。)

离散傅里叶变换

给定 N 个数字 f0、f1、f 2, …, fN-1,DFT 给出一组不同的 N 数字。

具体来说:令 ω 为 1 的原N根(无论是在复数中还是在某个有限域中),这意味着 ωN=1 但不小于 1 的幂是 1。您可以将 fk 视为多项式 P(x) = Σfkxk 的系数。 DFT 给出的 N 个新数字 F0、F1、...、FN-1评估多项式 的 ω 次幂的结果。也就是说,对于从 0 到 N-1 的每个 n,新数 Fn 为 P(ωn) = Σ 0≤k≤N-1 fkωnk

image of dft

[选择 ω 的原因是逆 DFT 具有很好的形式,与 DFT 本身非常相似。]

请注意,发现这些 F 天真地进行 O(N2) 操作。但是我们可以利用来自我们选择的 ω 的特殊结构,这使我们能够在 O(N log N) 中完成它。任何这样的算法都称为快速傅里叶变换。

快速傅里叶变换

这是进行 FFT 的一种方法。我将用 2N 替换 N 以简化符号。我们有 f0、f1、f2、...、f2N-1,我们想要计算 P(ω0), P(ω1), … P(ω2N-1) 我们可以在其中写

P(x) = Q(x) + ωNR(x) 与

Q(x) = f0 + f1x + …+ fN-1xN- 1

R(x) = fN + fN+1x + …+ f2N-1x 2N-1

现在这就是事情的美妙之处。观察 ωk+N 处的值与 ωk 处的值非常简单地相关:
P(ωk+N) = ωN(Q(ωk) + ωNR(ω k)) = R(ωk) + ωNQ(ωk)。因此,Q 和 R 在 ω0 到 ωN-1 处的评估就足够了。

这意味着您最初的问题 - 在 2N 个点 ω0 到 ω2N-1 处评估 2N 项多项式 P - 已简化为两个在 N 点 ω0 到 ωN-1 处评估 N 项多项式 Q 和 R 的问题。因此,运行时间 T(2N) = 2T(N) + O(N) 等等,得出 T(N) = O(N log N)。

DFT 示例

请注意,其他定义使用 1/N 或 1/√N 因子。

对于N=2,ω=-1,(a,b)的傅立叶变换为(a+b,ab)。

对于 N=3,ω 是 1 的复立方根,(a,b,c) 的傅立叶变换为 (a+b+c, a+bω+cω2, a+ bω2+cω)。 (因为 ω4=ω。)

对于 N=4 且 ω=i,(a,b,c,d) 的傅立叶变换为 (a+b+c+d, a+双-c-di、a-b+cd、a-bi-c+di)。特别是,您问题中的示例: (1,0,0,0) 上的 DFT 给出 (1,1,1,1),可能不是很有启发性。

You're right, "the" Fast Fourier transform is just a name for any algorithm that computes the discrete Fourier transform in O(n log n) time, and there are several such algorithms.

Here's the simplest explanation of the DFT and FFT as I think of them, and also examples for small N, which may help. (Note that there are alternative interpretations, and other algorithms.)

Discrete Fourier transform

Given N numbers f0, f1, f2, …, fN-1, the DFT gives a different set of N numbers.

Specifically: Let ω be a primitive Nth root of 1 (either in the complex numbers or in some finite field), which means that ωN=1 but no smaller power is 1. You can think of the fk's as the coefficients of a polynomial P(x) = ∑fkxk. The N new numbers F0, F1, …, FN-1 that the DFT gives are the results of evaluating the polynomial at powers of ω. That is, for each n from 0 to N-1, the new number Fn is P(ωn) = ∑0≤k≤N-1 fkωnk.

image of dft

[The reason for choosing ω is that the inverse DFT has a nice form, very similar to the DFT itself.]

Note that finding these F's naively takes O(N2) operations. But we can exploit the special structure that comes from the ω's we chose, and that allows us to do it in O(N log N). Any such algorithm is called the fast Fourier transform.

Fast Fourier Transform

So here's one way of doing the FFT. I'll replace N with 2N to simplify notation. We have f0, f1, f2, …, f2N-1, and we want to compute P(ω0), P(ω1), … P(ω2N-1) where we can write

P(x) = Q(x) + ωNR(x) with

Q(x) = f0 + f1x + … + fN-1xN-1

R(x) = fN + fN+1x + … + f2N-1x2N-1

Now here's the beauty of the thing. Observe that the value at ωk+N is very simply related to the value at ωk:
P(ωk+N) = ωN(Q(ωk) + ωNR(ωk)) = R(ωk) + ωNQ(ωk). So the evaluations of Q and R at ω0 to ωN-1 are enough.

This means that your original problem — of evaluating the 2N-term polynomial P at 2N points ω0 to ω2N-1 — has been reduced to the two problems of evaluating the N-term polynomials Q and R at the N points ω0 to ωN-1. So the running time T(2N) = 2T(N) + O(N) and all that, which gives T(N) = O(N log N).

Examples of DFT

Note that other definitions put factors of 1/N or 1/√N.

For N=2, ω=-1, and the Fourier transform of (a,b) is (a+b, a-b).

For N=3, ω is the complex cube root of 1, and the Fourier transform of (a,b,c) is (a+b+c, a+bω+cω2, a+bω2+cω). (Since ω4=ω.)

For N=4 and ω=i, and the Fourier transform of (a,b,c,d) is (a+b+c+d, a+bi-c-di, a-b+c-d, a-bi-c+di). In particular, the example in your question: the DFT on (1,0,0,0) gives (1,1,1,1), not very illuminating perhaps.

听,心雨的声音 2024-09-15 20:53:32

FFT只是DFT的有效实现。两者的结果应该是相同的,但一般来说 FFT 会快得多。确保您首先了解 DFT 的工作原理,因为它更简单且更容易掌握。

当您了解 DFT 后,请继续学习 FFT。请注意,虽然一般原理是相同的,但 FFT 有许多不同的实现和变化,例如时间抽取 v 频率抽取、基 2 v 其他基和混合基、复数到复数 v 实数-to-complex 等。

关于该主题的一本很好的实用书籍是快速傅里叶变换和它的应用,作者:E. Brigham。

The FFT is just an efficient implementation of the DFT. The results should be identical for both, but in general the FFT will be much faster. Make sure you understand how the DFT works first, since it is much simpler and much easier to grasp.

When you understand the DFT then move on to the FFT. Note that although the general principle is the same, there are many different implementations and variations of the FFT, e.g. decimation-in-time v decimation-in-frequency, radix 2 v other radices and mixed radix, complex-to-complex v real-to-complex, etc.

A good practical book to read on the subject is Fast Fourier Transform and Its Applications by E. Brigham.

故事还在继续 2024-09-15 20:53:32

是的,FFT 只是一种高效的 DFT 算法。理解 FFT 本身可能需要一些时间,除非您已经研究过复数和连续傅立叶变换;但它基本上是对从周期函数导出的基数的基数变化。

(如果您想了解有关傅里叶分析的更多信息,我推荐 Gerald B. Folland 的《傅里叶分析及其应用》一书)

Yes, the FFT is merely an efficient DFT algorithm. Understanding the FFT itself might take some time unless you've already studied complex numbers and the continuous Fourier transform; but it is basically a base change to a base derived from periodic functions.

(If you want to learn more about Fourier analysis, I recommend the book Fourier Analysis and Its Applications by Gerald B. Folland)

空名 2024-09-15 20:53:32

我也是傅里叶变换的新手,我发现这本在线书籍非常有帮助:

科学家和工程师数字指南信号处理

该链接将带您进入有关离散傅里叶变换的章节。本章解释了所有傅里叶变换之间的区别,以及在哪里使用哪个变换,以及显示如何计算离散傅里叶变换的伪代码。

I'm also new to Fourier transforms and I found this online book very helpful:

The Scientists and Engineer's Guide to Digital Signal Processing

The link takes you to the chapter on the Discrete Fourier Transform. This chapter explains the difference between all the Fourier transforms, as well as where you'd use which one and pseudocode that shows how you go about calculating the Discrete Fourier Transform.

Oo萌小芽oO 2024-09-15 20:53:32

如果您寻求 DFT 的简单英语解释以及一点 FFT,而不是学术性的goggledeegoo,那么您必须阅读以下内容:http://blogs.zynaptiq.com/bernsee/dft-a-pied/

我无法解释我自己就更好了。

If you seek a plain English explanation of DFT and a bit of FFT as well, instead of academic goggledeegoo, then you must read this: http://blogs.zynaptiq.com/bernsee/dft-a-pied/

I couldn't have explained it better myself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文