I am looking for the Fourier Series of this function:

This is a winding function method for calculation of rotor inductances. The distance between each stator slot (each segment) is $10$ degrees or $\dfrac \pi{18}$. Since this function is periodic after each 360 degree I can use Fourier Series. The function is even: $b(n)=0$ and it has only
a(n) = (2/PI)*(int(36*cos(n*w*phi),phi=0..2*PI/18)+int(24*cos(n*w*phi),phi=2*pi/18..3*PI/18)+ int(12*cos(n*w*phi),phi=3*PI/18..4*pi/18)+...)
I wrote this code on MATLAB and got a correct answer(below figure).But I need to calculate the simplified algebraic equation for this figure.
Thanks
