I'm having getting errors with my code an I'm not sure how to fix the problem.
(*Define the even function*)
feven[t_] := 1-t
(*Fourier coefficients*)
a[0] = 2/\ Integrate[feven, {t, 0, 1}];
a[n_] := (4/\) Integrate[feven Cos[n \ t], {t, 0, +\/2}];
(*Fourier approximation function*)
fapp[t_, n_] :=
a[0] + Sum[a[2 x - 1] Cos[(2 x - 1) \ t], {x, 1, n}];
(*Plot the function over a time interval *)
Plot[{fapp[t, 6], f}, {t, 0, 1}]
I'm getting error functions:
Integrate::ilim: "Invalid integration variable or limit(s) in {0.0000204286,0,1.}."
NIntegrate::itraw: Raw object 0.000020428571428571424` cannot be used as an iterator.
However when I try things like fapp[1,6] I get accurate and real values. I'm not sure how to fix this problem.