0
$\begingroup$

In this course (Coursera: Audio Signal Processing for Music Applications) the professor derives a general equation for finding the DFT for real sinusoids:

DFT of real sinusoids \begin{align} x_3[n]&= A_0\cos\left(2\pi k_0 n/N\right)=\boxed{\frac{A_0}{2}e^{j2\pi k_0 n/N} +\frac{A_0}{2}e^{-j2\pi k_0 n/N}}\\ X_3[k]&=\sum_{n=-N/2}^{N/2-1} x_3[n]e^{-j2\pi k n/N}\\ &=\sum_{n=-N/2}^{N/2-1}\left(\frac{A_0}{2}e^{j2\pi k_0 n/N} +\frac{A_0}{2}e^{-j2\pi k_0 n/N}\right)e^{-j2\pi k n/N}\\ &=\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{j2\pi k_0 n/N}e^{-j2\pi k n/N} +\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{-j2\pi k_0 n/N}e^{-j2\pi k n/N}\\ &=\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{-j2\pi\left(k-k_0\right) n/N}+\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{-j2\pi\left(k+k_0\right) n/N}\\ &=N\frac{A_0}{2}\text{ for }k=k_0,-k_0; 0\text{ for the rest of }k \end{align}

Keeping this in mind, given a discrete signal $x[n]$ that has 4 samples given as: $[1, -1, 1, -1]$

the equation from the slide can be used to represent our signal as: \begin{align} x[n] &= {A_0\over2}e^{j2 \pi k_0 n/N} + {A_0\over2}e^{-j2 \pi k_0 n/N}\\ &= {e^{j 4 \pi n/4}\over2} + {e^{-j 4 \pi n/4}\over2}\\ &= {e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \end{align}

And now again, calculating $X[2]$ with the equations from the same slide:

\begin{align} X[2]&=\sum_{n=-N/2}^{N/2-1} \left({e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \right) e^{-j2\pi kn/N}\\ &=\sum_{n=-N/2}^{N/2-1} \left({e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \right) e^{-j4\pi n/4}\\ &=\sum_{n=-N/2}^{N/2-1} \left({e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \right) e^{-j\pi n}\\ &=\sum_{n=-N/2}^{N/2-1} {e^{j (\pi n - \pi n)}\over2} + {e^{-j 2 \pi n}\over2}\\ &= \frac N2 + \frac N2\\ &= N \end{align}

But this contradicts the last line on the slide that says $X[2]$ should be $N{A_0\over2}$.

  1. Are the slides wrong?

  2. I'm also having trouble figuring proving/understanding the following equality from the lecture slide:

    $$\sum_{n=-N/2}^{N/2-1} {A_0\over2} e^{-j2\pi(k-k_0)n/N} + \sum_{n=-N/2}^{N/2-1} {A_0\over2} e^{-j2\pi(k+k_0)n/N} = N\frac{A_0}{2}\text{ for } k=k_0, -k_0$$

PS: From the same course, some slide from a another lecture show these equations that are consistent with my derivation (see equation for $<x,s_2>$)

DFT: scalar product: $$ \boxed{<x, s_k>=\sum_{n=0}^{N-1}x[n]s_k^{*}[n]=\sum_{n=0}^{N-1}x[n]e^{-j2 \pi k n/N}} $$ Example:

$$x[n]=[1, -1, 1, -1]; N=4$$

\begin{align} <x, s_0>&=1*1 +(-1)*1 + 1*1 + (-1)*1 =0\\ <x, s_1>&=1*1 +(-1)*(-j) + 1*(-1) + (-1)*j =0\\ <x, s_2>&=1*1 +(-1)*(-1) + 1*1 + (-1)*(-1) =4\\ <x, s_3>&=1*1 +(-1)*j + 1*(-1) + (-1)*(-j) =0\\ \end{align}

$\endgroup$
  • $\begingroup$ Thanks @Gilles. I tend to post screenshots to preserve authenticity of material from slides/publish text. Why do you convert it to mathjax? Indexing? $\endgroup$ – GrowinMan Aug 29 '16 at 16:28
  • 1
    $\begingroup$ IMHO, it is better displayed and keeps dsp.se clean this way. There's quoting with the character > if you want to preserve authenticity, and then add a link to the source. In this way all questions are standardized. $\endgroup$ – Gilles Aug 29 '16 at 17:10
3
$\begingroup$

It's not a contradiction. It's just that for an alternating signal the two contributions at $\pm k_0$ coincide and add up. Note that in your example with $N=4$, you have $k_0=\pm 2$, but these two values of $k_0$ are in fact identical due to the periodicity of $N=4$: $X[-2]=X[2]$.

The same would be true for $k_0=0$, i.e. a constant signal (with frequency zero and amplitude $A_0$). In that case you'd get $X[0]=A_0N$, just like in the case of a signal at Nyquist (maximum frequency, as in your example) where you get $X[N/2]=A_0N$. For all other values of $k_0$ you get two contributions with amplitudes $A_0N/2$.

Regarding your second question, this is an identity that is very important in DSP. First of all note that due to periodicity of the complex exponential function you have the equality

$$\sum_{n=-N/2}^{N/2-1}e^{-j2\pi (k-k_0)n/N}=\sum_{n=0}^{N-1}e^{-j2\pi (k-k_0)n/N}\tag{1}$$

For $k=k_0$ the complex exponential in $(1)$ becomes $1$, so the sum equals $N\cdot 1=N$. For $k\neq k_0$ you can use the formula for the geometric series to see that

$$\sum_{n=0}^{N-1}e^{-j2\pi (k-k_0)n/N}=\frac{1-e^{-j2\pi (k-k_0)}}{1-e^{-j2\pi (k-k_0)/N}}=0\tag{2}$$

because for $k\neq k_0$ we have $e^{-j2\pi (k-k_0)}=1$.

$\endgroup$
  • $\begingroup$ Your answer doesn't help clear my confusion. 1. In the second image that I posted, it shows $X[0]=0$ whereas you insist $X[0]=4$ $\endgroup$ – GrowinMan Aug 28 '16 at 23:02
  • $\begingroup$ 2. I just edited the question details to add '#2' in the question. I guess it might help if you could explain that as well. $\endgroup$ – GrowinMan Aug 28 '16 at 23:08
  • 1
    $\begingroup$ @GrowinMan This answer does not say $X[0]=4$ for the case $k_0 =2$. Try reading the answer again. $\endgroup$ – Peter K. Aug 28 '16 at 23:12
  • $\begingroup$ @PeterK. you meant $X[0]=4$? But yeah, you're right. Sorry I didn't read it right the first time. $\endgroup$ – GrowinMan Aug 28 '16 at 23:36
  • $\begingroup$ Okay I understand that $X[N-k] = X[-k]$ for real signals, and so $X[4-2] = X[-2] = X[2]$ just like $X[4-1] = X[-1] = X[3]$. But I don't understand why those values would add up at $k_0= \pm2$. $\endgroup$ – GrowinMan Aug 28 '16 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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