Discrete Fourier Transform on even function

However, if you don't care about the y-axis and just want the function to be even, you can have any number of samples.
  • #1
mathman44
207
0
The DCT of an even function is comprised of just cosine coefficients, correct?

I'm playing around in MATLAB and I came up with a simple even function

1.0000
0.7500
0.5000
0.2500
0
0.2500
0.5000
0.7500
1.0000
0.7500
0.5000
0.2500
0
0
0
0
0
0
0.2500
0.5000
0.7500
1.0000
0.7500
0.5000
0.2500
0
0.2500
0.5000
0.7500
1.0000

But get imaginary as well as real outputs when I use the DFT on it. Which means that my function isn't even?

Can anyone help me make sense of this?
 
Last edited:
Physics news on Phys.org
  • #2
Where is x=0 in your list?
And where are sin/cos coefficients in the result?
 
  • #3
Hi mfb,

I haven't assigned x values to the points. The DCT really just considers the index of each point, (n=0,1,2...N-1) and the total number of samples (N) right?

But since it's even, let's say x ranges from -14.5 to 14.5 in steps of "1".

The sin/cos coefficients are listed in the second list in my first post. The sin coefficients are the imaginary ones - I don't understand why I'm getting sin coefficients.
 
Last edited:
  • #4
I assume when you write DCT, you actually mean DFT.

DFT = discrete Fourier transform
DCT = discrete cosine transform

The problem is that your input function is not even. If you remove the final element (1) then it will be even, and you will obtain a real-valued result.
 
  • #5
Hi jbunniii,

Yes I mean DFT. Can you explain why the final element needs to be removed? In my mind the function is even since f(x)=f(-x) if you center it on the y-axis for example.
 
  • #6
Yes, think about extending your function periodically in both directions. The first element in the array corresponds to x = 0. In order for the function to be even, the element to the left of this must equal the element to the right. This is not the case if we use your original function:

$$\begin{array}
\text{f(x)} & \ldots & 0.5 & 0.75 & 1 & 1 & 0.75 & 0.5 & \ldots \\
x & \ldots & -3 & -2 & -1 & 0 & 1 & 2 & \ldots
\end{array}$$

Note that we do not have f(-1) = f(1), so the function is not even.

On the other hand, if we remove the 1 at the end of the array, and again extend the function periodically, now we get an even function:

$$\begin{array}
\text{f(x)} & \ldots & 0.5 & 0.75 & 1 & 0.75 & 0.5 & \ldots \\
x & \ldots & -2 & -1 & 0 & 1 & 2 & \ldots
\end{array}$$
 
  • #7
To clarify, by "extend the function periodically," I mean that the array is supposed to represent one period of the function. For example, if the array was (1, 2, 3, 4) then extending it periodically means simply repeating it over and over: (...,1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, ...) where x = 0 always corresponds to the first element in the original array.
 
  • #8
Of course - thanks, that certainly clears it up. So an even function must always have an odd number of discrete samples (i.e. N is odd), right?
 
Last edited:
  • #9
mathman44 said:
Of course - thanks, that certainly clears it up. So an even function must always have an odd number of discrete samples (i.e. N is odd), right?
No, you can make an even function for any N. For example, the following are all even functions when extended periodically:

N = 1: (1)
N = 2: (1 0)
N = 3: (1 0 0)
N = 4: (1 0 0 0)
etc.
 
  • #10
Sorry I wasn't being very clear. What I mean is that if I want to make a function that is symmetric with respect to the y-axis AND satisfies the condition above, then it would seem I can only use an odd N of samples.

For example assume 15 points lie to the left of the y-axis, then by necessity we can only have 14 points lie to the right of the x-axis to satisfy the condition that you discussed. To use my example, if this portion lies to the left of the y-axis

1.0000
0.7500
0.5000
0.2500
0
0.2500
0.5000
0.7500
1.0000
0.7500
0.5000
0.2500
0
0
0

then the following must lie to the right of the y-axis

0
0
0
0.2500
0.5000
0.7500
1.0000
0.7500
0.5000
0.2500
0
0.2500
0.5000
0.7500Which is a total of 29 samples.
 
  • #11
mathman44 said:
Sorry I wasn't being very clear. What I mean is that if I want to make a function that is symmetric with respect to the y-axis AND satisfies the condition above, then it would seem I can only use an odd N of samples.
Yes, if you want the array (which represents a single period of the periodic function) to be symmetric in terms of having the same number of samples on each side of the y axis, you need an odd number of samples. This is because you need one sample on the y-axis itself, and all the other samples need to occur in pairs.
 

1. What is a Discrete Fourier Transform (DFT)?

The Discrete Fourier Transform (DFT) is a mathematical tool used to analyze the frequency components of a discrete signal. It converts a signal from its original domain (usually time or space) to a representation in the frequency domain.

2. What is an even function?

An even function is a mathematical function that exhibits symmetry about the y-axis. This means that if you reflect the function about the y-axis, it remains unchanged. In other words, an even function f(x) satisfies the condition f(x) = f(-x).

3. Can the Discrete Fourier Transform be applied to even functions?

Yes, the Discrete Fourier Transform can be applied to even functions. However, since even functions have a special symmetry property, the DFT can be simplified and the resulting spectrum will have a specific structure that can be exploited for efficient computation.

4. How is the Discrete Fourier Transform applied to an even function?

To apply the Discrete Fourier Transform to an even function, we first sample the function at evenly spaced points and then calculate the DFT using a fast Fourier transform (FFT) algorithm. The resulting spectrum will have a peak at the midpoint and will have symmetric values on either side.

5. What are some practical applications of the Discrete Fourier Transform on even functions?

The Discrete Fourier Transform on even functions has many practical applications, including image and signal processing, audio compression, and data analysis. It is also used in various areas of science and engineering, such as in the study of vibrations and waves, system identification, and pattern recognition.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Replies
4
Views
5K
  • Differential Equations
Replies
4
Views
2K
Replies
11
Views
813
  • Calculus
Replies
8
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
Replies
1
Views
831
Back
Top