I have a very 2d non-linear differential algebraic equation I'm trying to solve with NDSolve.
The solution seems fine, but There are some numerical issues I cannot manage to control, and I don't know how to approach it.
Here is the example
f[x_, z_] := ((20 z)/(1 - Exp[-20 x z])/(
1 + (20 z)/(1 - Exp[-20 x z])) - (20 z Exp[-20 x z])/(
1 - Exp[-20 x z])/(
1 + (20 z Exp[-20 x z])/(1 - Exp[-20 x z]))) - z;
f[x_, y_, z_] := z - 0.1 (x - 1) (1 + 1/(4 y) Exp[(x - 1)/(5 y)]);
g[x_, y_] := 1 - y - y Exp[(x - 1)/(5 y)];
sol = NDSolve[{
f[x[t], z[t]] == 0,
x'[t] == f[x[t], y[t], z[t]], y'[t] == g[x[t], y[t]], x[0] == 1.9,
y[0] == 0.9}, {x[t], y[t], z[t]}, {t, 0, 100},
Method -> {"EquationSimplification" -> {Automatic,
"SimplifySystem" -> True}}];
Plot[{Evaluate[x[t] /. sol], Evaluate[y[t] /. sol],
Evaluate[z[t] /. sol]}, {t, 0, 10},
PlotLegends -> Placed[{"x(t)", "y(t)", "z(t)"}, {Right, Top}],
Frame -> True, FrameLabel -> {Style["t", FontSize -> 14, Black], ""}]
Plot[{Evaluate[z[t] /. sol]}, {t, 0, 10},
PlotLegends -> Placed[{"z(t)"}, {Right, Top}], Frame -> True,
FrameLabel -> {Style["t", FontSize -> 14, Black], ""}]
When I plot the three functions together, the solution seems fine. however when I plot $z(t)$ by itself, you can see that there is always noise.
How can I add a fixed step to the solution of the DAE, or somehow monitor that what that I'm doing is correct?
PlotRange->All
for thez
plot. $\endgroup$ – user21 Apr 10 '18 at 8:43PlotRange -> {0.94, 0.96}
. $\endgroup$ – user21 Apr 10 '18 at 8:49