Hello,
I have a problem using Manipulate to tweek a coupled differential equation system. Maybe someone can help me out with this. I try to give a brief explanation:
- I defined a piecewise function which consist of 3 variables.
- I let mathematica solve my differential equations which are also dependent on the above piecewise function. The parameters defined, are 2 of the 3 from the piecewise function above.
- With Manipulate I try to plot the solutions of the coupled differential equations for different values of the parameters.
The outcome is the manipulate graphical window with only 1 of 3 expected plots. Does anyone see a mistake in my coding?
Best regards
q[t_, p_, tau_] =
Piecewise[{{Exp[-t/tau], 0 <= t <= p}, {Exp[-p/tau], p < t}}];
s = ParametricNDSolve[{alpha'[t] ==
alpha[t]*(n[t] - q[t, p, tau]) - 1*alpha[t]/2100,
n'[t] == -n[t]*alpha[t], alpha[0] == 0.0001, n[0] == 1}, {n[t],
alpha[t]}, {t, 0, 5000}, {p, tau}]
Manipulate[
Plot[Evaluate[{alpha[t]*100, n[t], q[t, p, tau]} /. s], {t, 0, 5000},
PlotRange -> {{0, 5000}, {0, 2}},
PlotLegends -> {"alpha[t]", "n[t]", "q[t]"}], {p, 0, 5000}, {tau, 1,
5000}]