Chirp z算法说明

信息处理 fft 算法 自由度
2022-02-22 17:33:18

我正在尝试实现一个 chirp z 算法来处理随机大小的 DFT,但我似乎无法获得任何有意义的结果。我已经阅读了几篇文章并“认为”我已经掌握了啁啾变换应该做什么,但我想在这里要求仔细检查并确保我对这个过程的理解是正确的。在伪代码中,这是我正在应用的过程。

*function Chirpz(input x[n], discrete values such that n = 0, 1, ... N - 1)*
*// To keep numbers in perspective I will assume N = 5.*

M = The minimum power of 2 which is greater than 2N - 1 // In our case of N=5 => M=16.

Pad x[n] with 0s so that it has a total length of M.

// Create y[n] by performing the following:

value = 1 - N<br>
for n = 0 to n = 2N - 1<br>
y[n] = e^i(PI / N * value * value)     // W^((k - n)^2 / 2)
value = value + 1<br>
next n

Pad y[n] with 0s so that it has a total length of M.

// Multiply x[n] by W^(-n^2 / 2):


for n = 0 to n = N
x[n] = x[n] * e^-i(PI / N * n * n)

Perform FFT(x[n]) which has M elements using a radix-2 FFT algorithm
Perform FFT(y[n]) which has M elements using a radix-2 FFT algorithm

// With the results of the FFTs now in x[n] and y[n], multiply each value:
for n = 0 to n = M
x[n] = x[n] * y[n]

Perform IFFT(x[n]) which has M elements using radix-2 FFT algorithm

// Multiply x[n] by W^(-k^2 / 2)
for n = 0 to n = M
x[n] = x[n] * e^-i(PI / N * n * n)

// Now the first N elements in x[n] "should" have the result
X[k] = x[n] for n from 0 to N - 1

return X[k]

但是在给定相同输入的情况下,我的结果与 fftw3 返回的结果不匹配。事实上,我的结果看起来很垃圾。由于我对此很陌生,我只想确保我对算法的理解是正确的。

谢谢。

1个回答

好的,经过一番挠头和重新阅读后,我意识到我错过了什么。在创建卷积中使用的啁啾信号时,导致负数的 (k - n) 值需要环绕并放置在信号的末尾而不是开头。

所以,替换:

// Create y[n] by performing the following:

value = 1 - N<br>
for n = 0 to n = 2N - 1<br>
y[n] = e^i(PI / N * value * value)     // W^((k - n)^2 / 2)
value = value + 1<br>
next n

具有以下内容:

// Create y[n] by performing the following:

// Take care of values of k - n which are greater than zero.
for n = 0 to N - 1
y[n] = e^i(PI / N * n * n)

// Add the zero padding.
for n = N to M - N
y[n] = 0

// Now place the negative values at the end of the signal
for n = 1 - N to -1
y[M + n] = e^i(PI / N * n * n)

产生预期的结果。