I have periodic function with certain first impulse function and period value. My task is to decompose it to approximate Fourier series (k_max = 10) using Laplace transform of first impulse function:
So, I expect something like this:
Here is my code:
θ[x_] := Boole[x >= 0]
{R, L, C1, Rl, T, Um} := {500, 0.2, 2*10^(-10), 10^3, 10^(-3), 10};
{t1, t2, t3} := {T/2, T/3, T/6};
u1[t_] := Um/t3*(t*θ[t] - (t - t3) θ[t - t3] - (t - t2) θ[t - t2] + (t - t1) θ[t - t1])
U1[s_] := LaplaceTransform[u1[t], t, s]
Am10[ω_] = Abs[U1[I*ω]];
Ph10[ω_] = Arg[U1[I*ω]];
Am1[ω_] := Piecewise[{{Limit[Am10[ω0], ω0 -> 0], ω == 0}, {Am10[ω], ω != 0}}] (*Removing [0/0]-uncertainity*)
Ph1[ω_] := Piecewise[{{Limit[Ph10[ω0], ω0 -> 0], ω == 0}, {Ph10[ω], ω != 0}}] (*Removing [0/0]-uncertainity*)
{ω1, kmax} := {2*Pi/T, 10};
DAm1 = Table[0, 2*kmax + 1]; (*Container for Am1[k*ω1]; I need it for next part of work*)
DPh1 = Table[0, 2*kmax + 1]; (*Container for Ph1[k*ω1]*)
For[k = -10, k <= 10, k++, DAm1[[k + kmax + 1]] = Am1[k*ω1]];
For[k = -10, k <= 10, k++, DPh1[[k + kmax + 1]] = Ph1[k*ω1]];
elem[k_, t_] = Am1[k*ω1]*E^(I*(Ph1[k*ω1] + k*ω1*t));
fu[t_] = Sum[elem[k, t], {k, -kmax, kmax}];
Plot[fu[t], {t, -5 T, 5 T}, PlotRange -> {{-T, T}, {0, 12}},ImageSize -> 500]
However, I get a lot of errors. Here is the text for copying:
Internal precision limit $MaxExtraPrecision = 50.` reached while evaluating Log[...].
Indeterminate expression ArcTan[0,0] encountered.
Further output of N::meprec will be suppressed during this calculation.
Further output of ArcTan::indet will be suppressed during this calculation.
How do I fix it? Thanks in advance.
Note: the "*" symbol marks functions related first impulse (0 <= t <= T
).
ui[t]
function. Did you meanu1[t]
? Then,u1[t]
has correct plot (like the green one on the post, usingPlot[u1[t], {t, 0, T}]
). AboutFourierSeries
: I know this one, but I must realise decomposition manually. $\endgroup$