Science:Math Exam Resources/Courses/MATH307/December 2010/Question 06 (e)
• Q1 (a) • Q1 (b) • Q1 (c) • Q1 (d) • Q1 (e) • Q2 (a) • Q2 (b) • Q2 (c) • Q2 (d) • Q2 (e) • Q3 (a) • Q3 (b) • Q3 (c) • Q3 (d) • Q4 (a) • Q4 (b) • Q5 (a) • Q5 (b) • Q5 (c) • Q6 (a) • Q6 (b) • Q6 (c) • Q6 (d) • Q6 (e) • Q6 (f) • Q7 (a) • Q7 (b) • Q7 (c) •
Question 06 (e) 

Explain how you could use the fft command in MATLAB/Octave to compute approximations of the coefficients c_{n} in part (a). Write down the commands you would use, and say for what values of n you would expect your approximations to be most accurate. 
Make sure you understand the problem fully: What is the question asking you to do? Are there specific conditions or constraints that you should take note of? How will you know if your answer is correct from your work only? Can you rephrase the question in your own words in a way that makes sense to you? 
If you are stuck, check the hints below. Read the first one and consider it for a while. Does it give you a new idea on how to approach the problem? If so, try it! If after a while you are still stuck, go for the next hint. 
Hint 1 

fft in Matlab produces the discrete Fourier coefficients. How can we relate these to the exact Fourier coefficients? How does the period of discrete Fourier transform coefficients affect the accuracy of what you get? 
Hint 2 

Recall that the Discrete Fourier Transform coefficients of a function are defined as where are the total number of discrete points taken on a spatial interval , and . 
Hint 3 

Use a Riemann approximation of the integral expression of the Fourier coefficients from part (a). 
Checking a solution serves two purposes: helping you if, after having used all the hints, you still are stuck on the problem; or if you have solved the problem and would like to check your work.

Solution 

Found a typo? Is this solution unclear? Let us know here.
Please rate my easiness! It's quick and helps everyone guide their studies. The true Fourier coefficients as in part (a) are given by which we can approximate with a left Riemann sum over N points to get where . Compare this to the discrete Fourier transform coefficients defined by and comparing the expressions we see that . The discrete Fourier coefficients can be computed in Matlab using the command fft. Therefore, in Matlab, we need to sample over say 100 points and use fft, N = 100; x = linspace(0,1,N); C = fft(x); Since are the discrete Fourier coefficients, then the actual Fourier coefficients are given by (where in Matlab we arbitrarily chose that N=100). The discrete Fourier coefficients are periodic with period and so frequencies and are indistinguishable. Particularly this means that modes , will be indistinguishable to modes since they differ by period . These negative modes are relevant because they are the complex conjugates to modes and will therefore have the same amplitudes meaning that if a mode on has a high amplitude then so too will its complex conjugate affecting the result on . From part (a) we see that for the function , the amplitudes satisfied and that the highest amplitudes are for integers closest to zero. Therefore, negative modes slightly less than zero have the opportunity to create the biggest errors on modes slightly greater than . Conversely, the modes will only be affected by modes smaller than which for functions that behave like will have small amplitudes on that region and thus create small errors. The amplitudes are therefore most accurate for frequencies . 