# Fourier Series/ MatLab syntax

1. May 10, 2009

### cambone69

1. The problem statement, all variables and given/known data
(a) For each function determine the first 10 non zero elements in the Fourier series representation. Use Matlab to compute the coefficients, and graph the result.

2. Relevant equations
N/A

3. The attempt at a solution
I noted the even symmetry of the function, and thus I do not have to compute the "bn" (sine) coefficients. Also the fact that I can compute the cosine coefficients by integrating over half of the period, ie 0--->T/2. I know how to compute the coefficients by hand, however I am required to use Matlab.

In MatLab how would I define the function f (which appears to be a unit step function on half the period) in MatLab, with which I could multiply by cosine and then integrate appropriately?

This is a simple problem, however Matlab has become the biggest roadblock here.

Any help would be greatly appreciated.

Cam