Discrete Fourier Transform of Sine Function

Click For Summary
SUMMARY

The discussion centers on the Discrete Fourier Transform (DFT) of the sine function, specifically g(x) = sin(x). It is established that for an odd function like sine, the Fourier integral transform results in A(ω) = 0, leading to the expectation that the a_k coefficients from the DFT should also be zero. However, the results indicate non-zero a_k values, suggesting a misunderstanding in the periodic extension of the sine function. The correct approach involves defining g_j as sin(2πj/N) to accurately reflect the odd nature of the function over its period.

PREREQUISITES
  • Understanding of Fourier Transform concepts, particularly the Discrete Fourier Transform (DFT).
  • Knowledge of periodic functions and their properties, specifically odd and even functions.
  • Familiarity with trigonometric functions and their representations in Fourier series.
  • Basic proficiency in numerical methods for calculating DFT coefficients.
NEXT STEPS
  • Explore the mathematical derivation of the Discrete Fourier Transform (DFT) and its applications.
  • Study the properties of odd and even functions in the context of Fourier analysis.
  • Learn about the implications of periodic extension for functions in Fourier series.
  • Investigate numerical techniques for accurately computing Fourier coefficients from sampled data.
USEFUL FOR

Mathematicians, signal processing engineers, and anyone involved in Fourier analysis or digital signal processing will benefit from this discussion.

DuncanM
Messages
99
Reaction score
3
(1) For a real function, g(x), the Fourier integral transform is defined by
g(x) = \int_{0}^{\infty} A(\omega )cos(2\pi \omega x)d\omega - \int_{0}^{\infty} B(\omega )sin(2\pi \omega x)d\omega

where
A(\omega ) = 2 \int_{-\infty}^{\infty} g(x)cos(2\pi \omega x)dx

and
B(\omega ) = 2 \int_{-\infty}^{\infty} g(x)sin(2\pi \omega x)dx

For an even function, B(ω) = 0
For an odd function A(ω) = 0

(2) For discrete points, the function is declared as
g_{j} = a_{0} + \sum_{k = 1}^{[N/2]} a_{k} cos(kj\frac{2\pi}{N}) + \sum_{k = 1}^{[N/2]} b_{k} sin(kj\frac{2\pi}{N})

where
a_{k} = \frac{2}{N} \sum_{j = 0}^{N-1} g_{j} cos(jk\frac{2\pi}{N})

and
b_{k} = \frac{2}{N} \sum_{j = 0}^{N-1} g_{j} sin(jk\frac{2\pi}{N})

The text I am reading states that the discrete coefficients approximate the exact Fourier coefficients of a periodic function.

Now, taking a baby step, say I consider the function g(x) = sin(x), the plain, old sine function.
Since the sine function is odd, the Fourier integral transform indicates that A(ω) = 0.
Since the exact Fourier coefficients of a periodic function approximate discrete coefficients, I expected the a_{k} values of a DFT to be 0. But they are not. In fact, substituting the results of a DFT back into the original equation do not work without both the a_{k} and b_{k} values.

Here is what I did:
I assumed a period of 1 time unit, over 1 period, and divided the motion into uniform intervals. Calculating the sine values at each interval, this data was then fed into a DFT. The resultant transform includes both sine and cosine coefficients.

Shouldn't it include only coefficients for the sine terms?
What is going on? Have I made an incorrect leap in logic?
 
Mathematics news on Phys.org
So you are setting ##g_j = \sin(j)##? This does not result in an odd function when you extend it periodically. To see this, observe that ##g_1 = \sin(1)## whereas ##g_{-1} = g_{N-1} = \sin(N-1)##, which does not equal ##-\sin(1)##. Therefore, ##g_1 \neq -g_{-1}##.

Instead, try setting ##g_j = \sin(2\pi j / N)##, or more generally, ##g_j = \sin(2\pi j k /N)## where ##k## is any integer.
 
Here is some sample data. I wanted to have the points at t = T/4 and t = 3T/4 included, so the motion was divided into 20 uniform intervals.
T = 1 time unit.

Code:
k =  0    t = 0.0       sin(2*PI/20*t) =  0.0
k =  1    t =  0.05     sin(2*PI/20*t) =  0.309016994374947
k =  2    t =  0.1      sin(2*PI/20*t) =  0.587785252292473
k =  3    t =  0.15     sin(2*PI/20*t) =  0.809016994374947
k =  4    t =  0.2      sin(2*PI/20*t) =  0.951056516295154
k =  5    t =  0.25     sin(2*PI/20*t) =  1
k =  6    t =  0.3      sin(2*PI/20*t) =  0.951056516295154
k =  7    t =  0.35     sin(2*PI/20*t) =  0.809016994374947
k =  8    t =  0.4      sin(2*PI/20*t) =  0.587785252292473
k =  9    t =  0.45     sin(2*PI/20*t) =  0.309016994374948
k =  10   t =  0.5      sin(2*PI/20*t) =  0
k =  11   t =  0.55     sin(2*PI/20*t) =  -0.309016994374948
k =  12   t =  0.6      sin(2*PI/20*t) =  -0.587785252292473
k =  13   t =  0.65     sin(2*PI/20*t) =  -0.809016994374947
k =  14   t =  0.7      sin(2*PI/20*t) =  -0.951056516295154
k =  15   t =  0.75     sin(2*PI/20*t) =  -1
k =  16   t =  0.8      sin(2*PI/20*t) =  -0.951056516295154
k =  17   t =  0.85     sin(2*PI/20*t) =  -0.809016994374947
k =  18   t =  0.9      sin(2*PI/20*t) =  -0.587785252292473
k =  19   t =  0.95     sin(2*PI/20*t) =  -0.309016994374948
k =  20   t = 1.0       sin(2*PI/20*t) =   0
Taking just the sine values:

0.0
0.309016994374947
0.587785252292473
0.809016994374947
0.951056516295154
1
0.951056516295154
0.809016994374947
0.587785252292473
0.309016994374948
0
-0.309016994374948
-0.587785252292473
-0.809016994374947
-0.951056516295154
-1
-0.951056516295154
-0.809016994374947
-0.587785252292473
-0.309016994374948
0

and inputting them into a DFT, the following results are returned:

The ak values follow:

a0 = 0
0.14475387005697557
-0.020485172200211867
-0.016913755515248936
-0.015944715871194427
-0.015536943989308476
-0.015328780935943866
-0.015211428505699521
-0.015142744411310508
-0.015103970855542756
-0.015086357772515164

The bk values follow:

0.9603791769948659
-0.06641129715700931
-0.03512177522380782
-0.02338660289058022
-0.01674484324556045
-0.01222429488042325
-0.008782322342524462
-0.005943089235252812
-0.003447382785156719
-0.0011305662206714806

Shouldn't the ak values be 0? I mean, the DFT was performed on a simple sine function, and it doesn't get any more "pure" sine than that. Yet the DFT seems to indicate it includes some cosine factors. Is that correct, or am I making some wrong interpretation?
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K