# Discrete Fourier Transform of Sine Function

• DuncanM
In summary, the Fourier integral transform is defined for a real function g(x) as the integral of A(ω)cos(2πωx) and B(ω)sin(2πωx) over the interval [0,∞). A(ω) and B(ω) are determined by integrals over the entire real line. For an even function, B(ω) = 0 and for an odd function, A(ω) = 0. For discrete points, the function is declared as gj = a0 + Σk=1[N/2]akcos(kj2π/N) + Σk=1[N/2]bksin(kj2π/N), where
DuncanM
(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?

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?

## Question 1: What is the Discrete Fourier Transform (DFT) of a sine function?

The DFT of a sine function is a mathematical operation that converts a discrete sequence of values, such as a sine wave, into a representation of its frequency components. It is used to analyze signals and identify the frequencies present in a given signal.

## Question 2: How is the Discrete Fourier Transform (DFT) of a sine function calculated?

The DFT of a sine function is calculated by taking the discrete sequence of values and performing a series of mathematical operations, including a complex exponential function, to determine the amplitude and phase of each frequency component present in the signal.

## Question 3: What is the significance of the Discrete Fourier Transform (DFT) of a sine function in signal processing?

The DFT of a sine function is widely used in signal processing to analyze and manipulate signals in both time and frequency domains. It allows for the identification of specific frequencies present in a signal, which can be useful in noise filtering, signal compression, and spectral analysis.

## Question 4: How does the sampling frequency affect the Discrete Fourier Transform (DFT) of a sine function?

The sampling frequency, or the rate at which the discrete sequence of values is sampled, affects the accuracy and resolution of the DFT of a sine function. A higher sampling frequency will result in a more precise representation of the frequency components present in the signal.

## Question 5: What are some limitations of the Discrete Fourier Transform (DFT) of a sine function?

One limitation of the DFT of a sine function is that it assumes the signal being analyzed is periodic, which may not always be the case in real-world scenarios. Additionally, the DFT has a limited frequency resolution, which can make it difficult to accurately identify closely spaced frequency components.

• General Math
Replies
7
Views
1K
• General Math
Replies
1
Views
969
• General Math
Replies
2
Views
1K
• Engineering and Comp Sci Homework Help
Replies
3
Views
342
• General Math
Replies
4
Views
838
• Topology and Analysis
Replies
4
Views
635
• General Math
Replies
3
Views
2K
• General Math
Replies
3
Views
872
• General Math
Replies
12
Views
1K
• Calculus and Beyond Homework Help
Replies
5
Views
635