手动计算离散傅里叶变换
Discrete Fourier Transform by Hand

原始链接: https://www.byhand.ai/p/28-discrete-fourier-transform

离散傅里叶变换(DFT)是信号处理的基础,但其复杂的数学符号(涉及欧拉公式和复数)往往掩盖了其底层机理。本练习将通过证明DFT本质上是一系列矩阵乘法,来揭示其运作方式。 将DFT视为线性代数过程,便能明白为何同样依赖矩阵乘法的深度神经网络在信号分析方面表现出色。虽然像U-Net这样的神经网络是从数据(空间域)中学习最优滤波器,但DFT作为一种“固定”变换,是人为设计的,旨在将信号分解为组成它的余弦波(频域)。 该方法使用逆DFT在时域和频域之间转换信号,说明任何由一系列时域样本表示的信号,都可以重建为特定频率的加权和。通过应用DFT,我们可以在数学上“发现”这些未知权重,从而证明即使是最复杂的信号处理技术,其根源也是简单的、可计算的线性运算。

Sorry.
相关文章

原文

In signal processing, the Discrete Fourier Transform (DFT) is no doubt the most important method. But the math involved is extremely complex, literally, involving a summation over a complex number term e^(-iwt), where e is the Euler number, i is the imaginary unit, w is the angular frequency, and t is time.

I developed this exercise to demonstrate that underneath such complexity, DFT is just a series of matrix multiplications you can calculate by hand. ✍️ Once you see that, it should not surprise you that a deep neural network, which is also a series of matrix multiplications, with activation functions in-between, can learn to perform DFT to process and analyze signals so effectively.

💡 Learned vs. Fixed: U-Net learns its filters from data to process a signal in the spatial domain. The DFT is the classical opposite, a fixed transform, designed by hand rather than learned, that views the same signal in the frequency domain as a combination of cosine waves.

How does DFT work?

  • Signals A, B, and C in the 🟧 frequency domain:

  • A = cos(w) + 2cos(2w)

  • B = cos(w) + cos(3w) + cos(4w)

  • C = -cos(2w) + cos(3w)

  • Each signal is a weighed sum of four cosine waves at frequencies 1w, 2w, 3w, and 4w.

  • We will apply Inverse DFT to convert the signals to time domain representations, and then demonstrate DFT can convert back to their original frequency domain representations.

  • Signal X in the 🟩 time domain. X is sampled at 10 time points 1t, 2t, …, 10t:

  • X = [-2.5, -1.8, 3, -0.7, -1.0, -0.7, 3, -1.8, -2.5, 5]

  • Suppose X is also a weighted sum of the same four cosine waves, but we don’t already know their weights. We will apply DFT to discover them.

  • Sample from the continuous cosine waves at discrete time points 1t, 2t, 3t, to 10t.

联系我们 contact @ memedata.com