1

Let us assume a finite, aperiodic signal $x[n]$ upon which we perform DFT n times, as such:

DFT{DFT{DFT{...{DFT{$x[n]$}}...}

How can we calculate this directly instead of applying the DFT n times?

lennon310
  • 3,590
  • 19
  • 24
  • 27

1 Answers1

1

Let $\text{DFT}_2 = \text{DFT}(\text{DFT}(...))$. Then,

$$ \begin{align} \text{DFT}_2(x[n]) &= N \cdot x[-n] \\ \text{DFT}_3(x[n]) &= N \cdot \text{DFT}(x[-n]) \\ \text{DFT}_4(x[n]) &= N^2 \cdot x[n] \end{align} $$ and thus

$$ \text{DFT}_M(x[n]) = N^{\lfloor M/2 \rfloor} \cdot \begin{cases} \sum_{n=0}^{N-1} x[n\cdot (-1)^{\lfloor M/2 \rfloor}] e^{-j2 \pi k n /N}, & M=\text{odd} \\\ x[n\cdot(-1)^{\lfloor M/2 \rfloor}], & M=\text{even} \end{cases} $$

Note that $\text{DFT}_4(x[n])/N^2 = x[n]$.

Testing

import numpy as np
from numpy.fft import fft

def dft(x): N = len(x) out = np.zeros(N, dtype='complex128') for k in range(N): for n in range(N): out[k] += x[n] * np.exp(-2jnp.pi k * n / N) return out

def dft_M(x, M=1): N = len(x) sign = (-1)**(M//2)

if sign == -1:
    x_flip = np.zeros(N, dtype=x.dtype)
    x_flip[0] = x[0]
    x_flip[1:] = x[1:][::-1]
    x = x_flip

if M % 2 == 0:
    out = N**(M//2) * x
else:
    out = N**(M//2) * dft(x)
return out


for N in (128, 129): x = np.random.randn(N) + 1j*np.random.randn(N) assert np.allclose(fft(x), dft(x))

assert np.allclose(fft(fft(x)), dft_M(x, 2))
assert np.allclose(fft(fft(x)), dft_M(x, 2))
assert np.allclose(fft(fft(fft(x))), dft_M(x, 3))
assert np.allclose(fft(fft(fft(fft(x)))), dft_M(x, 4))

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74
  • Since you are breaking it out to $M$ even and $M$ odd, I might express it as

    $$ \mathcal{DFT}M \Big{x[n] \Big} = \begin{cases} N^{(M-1)/2} \ \sum\limits{n=0}^{N-1} x \big[n\cdot (-1)^{ (M-1)/2} \big] e^{-j2 \pi k n /N}, & M \ \text{odd} \ \ N^{M/2} \cdot x \big[n\cdot(-1)^{M/2} \big], & M \ \text{even} \ \end{cases} $$

    you won't really need the $\lfloor$ floor $\rfloor$ operator. And you do really have to confirm that $x[\cdot]$ is periodic with period $N$. $$ x[n+N] = x[n] \qquad \forall n \in \mathbb{Z} $$

    – robert bristow-johnson Jul 18 '21 at 23:51
  • @robertbristow-johnson We get $n \cdot i$ without floor, and fractional powers of $N$ (latter's valid depending on normalization). As for periodicity... sure, if we want to interpret it in terms of an infinite continuous-time function. – OverLordGoldDragon Jul 19 '21 at 01:17
  • if you look, there are no fractional powers of $N$ in the expression in my comment. the reason why something like periodicity needs to be explicit is because sometimes you have $x[-n]$. how are you gonna define the meaning of $x[-5]$ or similar? – robert bristow-johnson Jul 19 '21 at 01:32
  • 1
    @robertbristow-johnson Right, I missed that @ frac. On $-n$, absolutely, we define it to extend periodically - I meant on between $0$ and $N-1$, or inferring on $x(t)$ without having samples outside $0$ and $N-1$. – OverLordGoldDragon Jul 19 '21 at 01:38