I would like to have a triangulare signal drive a ODE system, using SquareWave[]. Something seems to go wrong though during integration. Uext'[t]
and rate SquareWave[rate/(4 umax) t
evaluate to different graphs. What is the problem here? Thanks!
rate = 0.06;
umax = 0.9;
sol2 = Flatten[
Evaluate[{Uext[t], Uext'[t], rate SquareWave[rate/(4 umax) t]} /.
NDSolve[
{
Uext'[t] == rate SquareWave[rate/(4 umax) t],
Uext[0] == -umax
},
{Uext}, {t, 0, 400}]]];
Show[
Plot[Evaluate[{sol2[[2]], sol2[[3]]}], {t, 0, 400}],
AspectRatio -> 1,
PlotRange -> Automatic,
Frame -> True,
ImageSize -> {500, 500}]