Discrete Fourier Transform of Even Function

Click For Summary

Discussion Overview

The discussion revolves around the Discrete Fourier Transform (DFT) of the function defined as fn = cos(3πn/N) for n=0,1,...,N, focusing on the properties of even and odd functions in relation to the DFT and the resulting coefficients observed in Matlab.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Reuben expresses confusion regarding the DFT of an even function, noting that he expected real Fourier coefficients but received complex numbers in Matlab.
  • One participant asserts that the Fourier coefficients should be real and suggests a potential error in Reuben's use of Matlab.
  • Reuben shares his Matlab code, which produces a complex output for the DFT, prompting further analysis.
  • Another participant argues that the function is not exactly even due to the periodic assumption of the DFT, suggesting that the function is mostly odd and leads to a complex transform.
  • Reuben questions the claim that the function is not exactly odd, proposing that periodic extension would make it odd despite discontinuities.
  • A participant clarifies that for the function to be exactly odd, specific conditions regarding the values at n=0 and n=15 must hold, leading to a discussion about the implications of setting f(0)=0.
  • Reuben acknowledges the requirement for f(0)=0 to achieve an odd function, indicating a shift in understanding.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the nature of the function being even or odd under the DFT's periodic assumptions, with multiple competing views presented regarding the implications of discontinuities and the conditions for oddness.

Contextual Notes

The discussion highlights limitations related to the assumptions of periodicity in the DFT and the specific values of the function at certain points, which affect the classification of the function as even or odd.

rmp251
Messages
8
Reaction score
0
I'm confused about the DFT of the data, fn = cos(3[itex]\pi[/itex]n/N) for n=0,1,...,N. It is definitely an even function, and I read that the Fourier coefficients of an even function is real. But when I take the FFT of this in Matlab I get complex numbers, not real numbers. What am I missing?

Thanks !
Reuben
 
Physics news on Phys.org
The Fourier coefficients are real. I can only guess that there may be something wrong in the way you are using Matlab or Matlab may have an error.
 
The code is pretty simple:

N=16;
n = [0:N-1];
f = cos(3*pi*n/N);
F = fft(f,N);

The resulting F is:
1.0000
1.0000 + 4.1412i
1.0000 - 5.6858i
1.0000 - 2.0586i
1.0000 - 1.2027i
1.0000 - 0.7609i
1.0000 - 0.4596i
1.0000 - 0.2180i
1.0000
1.0000 + 0.2180i
1.0000 + 0.4596i
1.0000 + 0.7609i
1.0000 + 1.2027i
1.0000 + 2.0586i
1.0000 + 5.6858i
1.0000 - 4.1412i
 
This function is not even--remember that the DFT makes the hidden assumption that your signal is periodic outside of the specified ordinates, so f(-16:-1) = f(0:15). Your function is mostly (but not exactly) odd, so you mostly have an imaginary transform, but it is complex. You have a discontinuity between n=-1 and n=0 (and also n=16, 17), resulting in a smeared spectrum.
 
I understand... except the part where you say the function is not exactly odd. Based on what you're saying, if we extend the signal beyond n=0..N-1 to make it periodic, then isn't it exactly odd (regardless of any discontiniuity)?

Thanks all for the responses!
 
Not quite. Try plotting it in Matlab. You have f(0)=1, so to be exactly odd you'd need f(-1)=f(15) =-1. It's not.

EDIT: Ah, that's where the real 1's come from.

Imagine that you take your sequence as is except you set f(0)=0--now it's exactly odd, because f(1)=-f(-1)=-f(15). So the transform of this sequence is purely imaginary.
The sequence {f(0)=1, f(1:15)=0} is even so its spectrum is pure real. In fact, this sequence is an impulse, so its spectrum is all ones.
Add them together to form the total sequence you wrote. Since DFT is a linear operation, the total spectrum is the sum of the individual spectra, one of which is imaginary and the other of which is all real ones.
 
Last edited:
Why do we need f(-1)=f(15) = -1 ?

We have f(-1)=f(15) by periodic extension. And f(-1)= -f(1) = -0.8315.

We're talking about odd meaning antisymmetric about the f axis (n=0), correct?
 
Right. f(15)=f(-1)=-0.83 and f(1)=+0.83, etc., so the sequence is exactly odd if f(0)=0.
 
I was missing the f(0)=0 requirement. Makes sense now.

Thanks a lot for the insight!
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K