Register to reply 
Discrete Fourier Transform on even function 
Share this thread: 
#1
Jan2513, 02:38 PM

P: 210

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? 


#2
Jan2513, 03:39 PM

Mentor
P: 11,928

Where is x=0 in your list?
And where are sin/cos coefficients in the result? 


#3
Jan2513, 04:16 PM

P: 210

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...N1) 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. 


#4
Jan2513, 09:23 PM

Sci Advisor
HW Helper
PF Gold
P: 3,288

Discrete Fourier Transform on even function
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 realvalued result. 


#5
Jan2513, 11:16 PM

P: 210

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 yaxis for example. 


#6
Jan2513, 11:34 PM

Sci Advisor
HW Helper
PF Gold
P: 3,288

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
Jan2513, 11:40 PM

Sci Advisor
HW Helper
PF Gold
P: 3,288

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
Jan2513, 11:41 PM

P: 210

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?



#9
Jan2513, 11:49 PM

Sci Advisor
HW Helper
PF Gold
P: 3,288

N = 1: (1) N = 2: (1 0) N = 3: (1 0 0) N = 4: (1 0 0 0) etc. 


#10
Jan2613, 10:42 AM

P: 210

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 yaxis 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 yaxis, then by necessity we can only have 14 points lie to the right of the xaxis to satisfy the condition that you discussed. To use my example, if this portion lies to the left of the yaxis 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 yaxis 0 0 0 0.2500 0.5000 0.7500 1.0000 0.7500 0.5000 0.2500 0 0.2500 0.5000 0.7500 Which is a total of 29 samples. 


#11
Jan2613, 12:03 PM

Sci Advisor
HW Helper
PF Gold
P: 3,288




Register to reply 
Related Discussions  
Discrete Fourier Transform of Even Function  Calculus  8  
Fourier Transform of a discrete function  Calculus  0  
The discrete fourier transform  Advanced Physics Homework  1  
Discrete Fourier Transform  Engineering, Comp Sci, & Technology Homework  1  
Discrete Fourier Transform of Ramp Function  General Math  0 