I am trying to calculate the fourier series of $f(x)=\sin x$ for $0
f[x_] = If[x > 0, Sin[x], 0];
a[n_] := (2/L)*Integrate[f[x]*Cos[2 n*Pi*x/L], {x, -L/2, L/2}]
a[0] = (1/L)*Integrate[f[x], {x, -L/2, L/2}]
b[n_] := (2/L)*Integrate[f[x]*Sin[2 n*Pi*x/L], {x, -L/2, L/2}]
F[x_, N_] :=
a[o] + Sum[a[n]*Cos[2 n*Pi*x/L] + b[n]*Sin[2 n*Pi*x/L], {n, 1, N}]
p[N_, a_] :=
Plot[Evaluate[F[x, N]], {x, -a, a}, PlotRange -> All,
PlotPoints -> 200]
L = 2Pi;
a[n]
a[0]
b[n]
p[20, 1]
`
but the Plot doesn't seems correct. Then, for $f(x)=0?.$ What about the converge of the series?
Comments
Post a Comment