f[x_]:=Piecewise[{{0,-2<x<0},{2Sin[(π/2)x],0≤ x≤2}}]
T:=2
a0=(1/T)Integrate[f[x],{x,-T,T}]
ak=(1/T)Integrate[f[x]Cos[((k*π*x)/T)],{x,-T,T}]
bk=(1/T)Integrate[f[x]Sin[((k*π*x)/T)],{x,-T,T}]
s[n_,x_]:=(1/2)a0+Sum[ak*Cos[((k*π*x)/T)]+bk*Sin[((k*π*x)/T)],{k,2,n}]+Sin[((π*x)/T)]
Plot[s[10,x],{x,-T,T}]

g1=Plot[f[x],{x,-2.5,2.5}]

X