Message Boards Message Boards

0
|
13047 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How can I manipulate variables in an NDSolve differential equation?

Posted 11 years ago
ecosh =
NDSolve[{ex'[t] == r - (a*h*ex[t] ep[t]),
    ep'[t] == (f*a*ex[t]*ep[t])/(1 + a*h*ex[t]) - q*ep[t],
    ex[0] == 300, ep[0] == 100} /. {a -> 0.1, h -> 0.1, q -> 0.115,
    f -> 0.15, r -> 0}, {ex, ep}, {t, 0, 50}]
Plot[Evaluate[{ex[t], ep[t]} /. ecosh], {t, 0, 10}]

That's my code and there's the plot it yields. I'm tweaking a model and I want to be able to adjust all the parameters (i.e. a, h, q, f, r) as well as the starting conditions (ex[0] and ep[0]) quickly. However I haven't found a way that's compatible with using NDSolve. Any ideas?
POSTED BY: Jamby Humbert
2 Replies
Posted 11 years ago
Hi,
I do these types of things all of the time. I typically take the Manipulate approach. In this approach, wrap the NDSolve function in a Manipulate, and give each parameter a range of values. Just think of this as using Table to specify lists for each of the parameters, then you could iteratively search through the list or specify different values.
POSTED BY: Pat Mac
ParametricNDSolve gives you an NDSolve setup than contains parameters.

http://reference.wolfram.com/mathematica/ref/ParametricNDSolve.html
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract