If you know your periodic function, , you can just plug it into the recipe for the Fourier coefficients: and , and crank through the integrals for as many values of as you want.