Group Abstract Group Abstract

Message Boards Message Boards

1
|
9K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

ParametricNDSolve and Manipulate

Posted 10 years ago
POSTED BY: Chris Smith
2 Replies

You need to pass the parameter values to the parametric functions returned by ParametricNDSolve:

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, alpha}, {t, 0, 5000}, {p, tau}]

Manipulate[
 Plot[Evaluate[{alpha[p, tau][t]*100, n[p, tau][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}]
POSTED BY: Michael Rogers
Posted 10 years ago

Thank you! Your solution works just fine!!

POSTED BY: Updating Name
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard