Using complex exponentials (without FourierTrigSeries
):
\begin{align*} f(x) &= \sum\limits_{ - \infty}^{ + \infty} {{c_n}{e^{2 \cdot \pi \cdot i \cdot n \cdot t/T}} = } \sum\limits_{ - \infty}^{ + \infty} {{c_n}{e^{i \cdot n \cdot w \cdot t}}} \\ {c_n} &= \frac{1}{T}\int_{ - T/2}^{T/2} {f(t){e^{ - i \cdot n \cdot w \cdot t}}dt} \end{align*}
find the coefficients and plot one partial sum of this.
We have function
f[x_] := Which[-1 < x < 0, 1, 0 < x < 1, 0]
Which of the following are correct?
c[n_] := (1/T)*Integrate[f[t]*Exp[(-I*n*w*t)/T], {x, -T/2, T/2}]
c[0] := (1/(2*T))*Integrate[f[x], {x, -T/2, T/2}]
T=2;
c[n]
F[x_, N_] := Sum[c[n]*Exp[(I*n*w*t)/T], {n, 1, N}]
p[N_, c_]:=Plot[Evaluate[F[x, N]], {x, -10, 10}, PlotRange -> All, PlotPoints -> 200, PlotRange -> All, Frame -> True]
p[10, 5]