0
|
13444 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# 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?
2 Replies
Sort By:
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 11 years ago
 ParametricNDSolve gives you an NDSolve setup than contains parameters.http://reference.wolfram.com/mathematica/ref/ParametricNDSolve.html
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.