One way to measure the frequency response of a filter is to input separate cosine/sine wave at the desired frequency, measure the steady state output, stack the inputs/outputs into complex arrays, and divide. A more efficient way is to use the DFT, and somehow we get away with just inputting one sinusoid.

  1. Input $x_n = A \cos(\omega_0 n)$, with $\phi = 0$
  2. Measure the steady-state output: $$ \begin{align*} y_n = A | H(e^{j \omega_0}) | \cos\left (\omega_0 n + \angle H(e^{j\omega_0}) \right ) \end{align*} $$

  3. Compute the DFTs $Y_k$ and $X_k$

  4. Record $H_{\hat{k}} = \frac{Y_{\hat{k}}}{X_{\hat{k}}}$ at $\hat{k}$ that corresponds to $\omega_0$

What I'm trying to figure out is why this works, clearly there's phase information but I'm missing something in the derivation.

$$ \begin{align*} X_{\hat{k}} &= \sum_{n=0}^{N-1} x_n e^{-j \omega_0 n} \quad \text{where } \frac{2\pi}{N} \hat{k} = \omega_0 \\ &= \sum_{n=0}^{N-1} A \cos(\omega_0 n) e^{-j \omega_0 n} \\ &= \frac{A}{2} \sum_{n=0}^{N-1} \left (e^{j\omega_0 n} + e^{-j\omega_0 n} \right ) e^{-j\omega_0 n} \\ &= \frac{A}{2} \sum_{n=0}^{N-1} 1 + e^{-j 2 \omega_0 n} \end{align*} $$

$$ \begin{align*} Y_{\hat{k}} &= \sum_{n=0}^{N-1} A \left | H(e^{j\omega_0}) \right | \cos\left (\omega_0 n + \angle H(e^{j\omega_0}) \right ) e^{-j \omega_0} \\ &= \frac{A}{2} \left | H(e^{j\omega_0}) \right | \sum_{n=0}^{N-1} \left (e^{j(\omega_0 n + \angle H(e^{j\omega_0}))} + e^{-j(\omega_0 n + \angle H(e^{j \omega_0}))} \right ) e^{-j\omega_0 n} \\ &= \frac{A}{2} \left | H(e^{j\omega_0}) \right | \sum_{n=0}^{N-1} e^{j \angle H(e^{j\omega_0})} + e^{-j \angle H(e^{j \omega_0})} e^{-j 2 \omega_0 n} \\ & \; \Big\Downarrow \; \text{?} \\ &= \frac{A}{2} \left | H(e^{j\omega_0}) \right | e^{j \angle H(e^{j\omega_0})} \sum_{n=0}^{N-1} 1 + e^{-j 2 \omega_0 n} \end{align*} $$

The idea is that the phase information comes out by dividing:

$$ \begin{align*} H_{\hat{k}} &= \frac{Y_{\hat{k}}}{X_{\hat{k}}} = \left | H(e^{j\omega_0}) \right | e^{j \angle H(e^{j\omega_0})} \end{align*} $$

What am I missing?

  • 3
    $\begingroup$ DFT outputs are complex numbers, so when expressed in polar form they contain both magnitude and phase information. The phase angle of the complex value $\frac{Y_k}{X_k}$ would correspond to the filter's response. However, this only calculates the filter's response at one frequency; it doesn't yield its overall transfer function. $\endgroup$
    – Jason R
    Dec 17, 2013 at 20:05
  • $\begingroup$ Right, I know that, but how do I show that "it works" mathematically? How do I fill in the "?" in the derivation? $\endgroup$
    – toast
    Dec 17, 2013 at 21:23
  • 1
    $\begingroup$ The sum part of exponential part of the last line of $X_k$ is equal to zero, does that help? $\endgroup$ Dec 18, 2013 at 4:11
  • 1
    $\begingroup$ @geometrikal: The exponential term only sums to zero if $\omega_0$ is a multiple of $\frac{2\pi}{N}$. Otherwise, it doesn't go away, and you have to do some factoring to massage the expression into a Dirichlet kernel (the "periodic sinc") form. $\endgroup$
    – Jason R
    Dec 18, 2013 at 14:27

1 Answer 1


Thanks to geometrikal and Jason R, the sum of exponentials is equal to zero when $\omega_0 = \frac{2\pi}{N} \hat{k}$ and $0 \leq \hat{k} \leq N-1$, which is obvious when you realize that it's just the sum over $2 \hat{k}$ periods of $e^{-j2\omega_0n}$, where $T = \frac{2\pi}{2\omega_0} = \frac{N \pi}{2\pi \hat{k}} = \frac{N}{2 \hat{k}}$.

For $\hat{k} > N-1$, I suppose you would have to zero pad, which is where the digital sinc Jason R. mentions comes in.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.