How to compute the DFT of a cosine

  • Engineering
  • Thread starter ThinkingOutLoud
  • Start date
  • Tags
    Cosine Dft
In summary, the goal is to find a value for k that satisfies the boundary conditions that the series goes from 0 to N-1.
  • #1
ThinkingOutLoud
2
0
Homework Statement
Find the N-point Discrete Fourier Transform of x(n) = cos(2*pi*n/N)
Relevant Equations
DFT: x(k) = series from n=0 to N-1 of x(n) * exp^(-j*2*pi*n*k/N) for k=0 to N-1
IDFT: x(n) = series from k=0 to N-1 of x(k) *(1/N)* exp ^(+j*2*pi*n*k/N) for n = 0 to N-1
Hello,

This is a more general question than anything, but I am curious how to compute the DFT of a cosine wave.
Somebody tried to explain this to me as follows:

start by trying to find an x(k) who's IDFT equals cos(2*pi*n/N).
x(k) = (N/2) * (dirac-delat(k+1) _ dirac-delta(k-1)) only has values at k=1 and k=-1.

Thus the IDFT of x(k) is,
x(n) = series from k=0 to N-1 of (N/2) * (dirac-delat(k+1) _ dirac-delta(k-1))*(1/N)* exp ^(+j*2*pi*n*k/N) for n = 0 to N-1

this only has values at k= 1 and -1, so things simplify to
x(n) = (N/N) * (1/2) * (exp ^(+j*2*pi*n*1/N) + exp ^(+j*2*pi*n*(-1)/N) )

using eulers equation this becomes for cosine (.5*e^ja = cos(a) + i sin(a)

x(n) =cos(2*pi*n/N) which is the correct result (yay :)

However, what I don't understand is how we can justify evaluating k at -1 since our series technically goes from k=0 to N-1.
This makes me think that my solution is wrong. What are your thoughts?

Thanks,
:)
 
Physics news on Phys.org
  • #2
ThinkingOutLoud said:
Relevant Equations:: DFT: x(k) = series from n=0 to N-1 of x(n) * exp^(-j*2*pi*n*k/N) for k=0 to N-1
IDFT: x(n) = series from k=0 to N-1 of x(k) *(1/N)* exp ^(+j*2*pi*n*k/N) for n = 0 to N-1
One can also let ##k## go from ##-N/2## to ##N/2##, due to the periodicity of ##e^{\pm j 2 \pi n k/N}##. It is the convention usually used for the fast Fourier transform (FFT).
 
  • Like
Likes ThinkingOutLoud
  • #3
Hi,

Thank you for your reply. Ok, I guess that makes sense. In our book though, we technicaly haven't gotten to FFT so that probably why I haven't seen that yet.

Your response gave me an idea, given the periodicity of e±j2πnk/N , instead of choosing k=1 and k=-1, I could just as easily choose k=1 and k= N- some value?
the goal would be to still have by k boundary k=0 to N-1 so that I am consistent with our textbook.

Thanks.
 
  • #4
ThinkingOutLoud said:
Your response gave me an idea, given the periodicity of e±j2πnk/N , instead of choosing k=1 and k=-1, I could just as easily choose k=1 and k= N- some value?
the goal would be to still have by k boundary k=0 to N-1 so that I am consistent with our textbook.
That should work.
 

1. What is the DFT of a cosine?

The DFT (Discrete Fourier Transform) of a cosine is a mathematical operation that transforms a discrete time-domain signal into its frequency-domain representation. It is a way to analyze the frequency components of a signal and is commonly used in signal processing and data analysis.

2. How is the DFT of a cosine computed?

The DFT of a cosine can be computed using a mathematical formula called the Discrete Fourier Transform formula. This formula involves summing up the complex exponential function over all the discrete time points in the signal. There are also various algorithms and techniques that can be used to compute the DFT more efficiently, such as the Fast Fourier Transform (FFT) algorithm.

3. What are the steps to compute the DFT of a cosine?

The steps to compute the DFT of a cosine are as follows:

  1. Obtain a discrete time-domain signal of the cosine function.
  2. Apply a windowing function to the signal to minimize spectral leakage.
  3. Compute the DFT using the Discrete Fourier Transform formula or an FFT algorithm.
  4. Plot the magnitude and phase of the DFT to visualize the frequency components of the signal.

4. What is the purpose of computing the DFT of a cosine?

The purpose of computing the DFT of a cosine is to analyze the frequency components of a signal. This can be useful in various applications such as audio and image processing, data compression, and filtering. The DFT can also be used to reconstruct the original signal from its frequency components.

5. Are there any limitations to computing the DFT of a cosine?

Yes, there are some limitations to computing the DFT of a cosine. One limitation is that the DFT assumes the signal is periodic, which may not always be the case in real-world applications. Additionally, the DFT can only provide information about the frequency components of a signal up to a certain frequency, known as the Nyquist frequency. Beyond this frequency, the DFT will not accurately represent the signal's frequency components.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
960
  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
221
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Atomic and Condensed Matter
Replies
1
Views
623
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • General Engineering
Replies
3
Views
1K
Back
Top