# Fourier cosine series of displacement

I'm trying to calculate a Fourier Cosine Series of displacement for general 4-bar mechanism. My code not working. I don't understand why. I need the result as this form

 A Cos[x] + B Cos[2x] + C Cos[4x]+..


Constants -> {r0, r1, r2, r3, theta0, xc, yc};
r0 = 100;
r1 = 25.3;
r2 = 64;
r3 = 75;
r4 = 70;
theta0 = 130 Degree;
xc = -64.279;
yc = 76.604;
(*Displacement calcualtion*)
a[theta1_] := 2*r0*r3*Cos[theta0]-2*r1*r3*Cos[theta1];
b[theta1_] := 2*r0*r3*Sin[theta0]-2*r1*r3*Sin[theta1];
c[theta1_] :=
r0^2+r1^2+r3^2-r2^2-2*r0*r1(Cos[theta0]*Cos[theta1]+Sin[theta0]*Sin[theta1]);
t[theta1_] :=
(-b[theta1]+Sqrt[b[theta1]^2-c[theta1]^2+a[theta1]^2])/(c[theta1]-a[theta1]);
theta3[theta1_] := 2*ArcTan[t[theta1]];
y2[theta1_] := r3*Sin[theta3[theta1]] + yc;
FourierCosSeries[y2[theta1], theta1, 10]


The problem is that the command FourierCosSeries expects a function whose cosine series expansion can be evaluated exactly - while the function y2[theta1] is far too complicated. I would suggest replacing your final line of code with the numerical equivalent
y2f[theta1_] := Evaluate[1/Pi*NIntegrate[y2[theta1], {theta1, 0, Pi}] + 