Marion Problem 3.28

Find the Fourier expansion of the function F(t)=(Piecewise[{{-1,, -π/ω<t<0}, {+1,, 0<t<π/ω}}])  in the interval-π/ω<t<π/ω.

f1[t_,ω_,m_]:=(Sum[(4/(n π))Sin[n ω t] ,{n,1,2m-1,2}]);
g1[t_,ω_]:=Piecewise[{{-1,-(π/ω)≤t≤0},{+1,0≤t≤(π/ω)}}]

In the periodical interval, calculate and plot the sums of the first two terms, the first three terms, and the first four terms to demonstrate the convergence of the series.

Manipulate[Plot[{g1[t,ω],f1[t,ω,m]},{t,-(π/ω),(π/ω)},
PlotRange->{{-(π/ω),(π/ω)},{-1.5,1.5}},
AxesLabel->{t,F[t]},
PlotStyle->{{RGBColor[0, 0.501961, 1],Thickness[0.010]},{Thick,Orange}},
ImageSize->600
],
{{m,2,"Number of terms"},{1,2,3,4,5,10,25,50,100},Setter},
{{ω,π},0.1,10,0.01, Appearance->"Labeled"}
]