?If

f[t_]=If[t<T/2,h,0];

These are rules for assigning numerical values to h and T.

r={h->3,T->1};

rh={h->3};

rt={T->1};

?RGBColor

p1=Plot[f[t]/.r,{t,0,T/.r},PlotStyle->RGBColor[1,0,0]]

w = 2 π/T /.r

a[p_] = 2/T Integrate[Cos[p w t]f[t],{t,0,T}]/.rt

a[1]

a[2]

a[0]

?Limit

a0=Limit[a[p],p->0]

b[p_] = 2/T Integrate[Sin[p w t]f[t],{t,0,T}]/.rt

b[1]

b[2]

b[3]

b[4]

g[t_,n_] := a0/2 + Sum[b[p]Sin[p w t],{p,1,n}];

p2=Plot[g[t,1]/.r,{t,0,T/.r},PlotStyle->RGBColor[0,1,0]]

Show[p1,p2,PlotRange->All]

p2=Plot[g[t,5]/.r,{t,0,T/.r},PlotStyle->RGBColor[0,1,0]]

Show[p1,p2,PlotRange->All]

p2=Plot[g[t,20]/.r,{t,0,T/.r},PlotStyle->RGBColor[0,1,0]]

Show[p1,p2,PlotRange->All]

p2=Plot[g[t,200]/.r,{t,0,T/.r},PlotStyle->RGBColor[0,1,0]]

Show[p1,p2]