Message Boards Message Boards

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

Interpret the results of solving a system of differential equations

Posted 4 years ago

Hello all

I am new to Mathematica and have some trouble doing my work done.

In a paper, I encountered the following system of differential equations:

y'(t) = - 1/0.401 y(t) + u(t) / 0.401
z'(t) = -447 exp(2.24 z(t)) z(t) + y(t) 

Now I would like to have that system solved, for y(0) =0, z(0) = 0. I addition I fixed u(t) to 20 (can I leave it as a variable?).

I ask Mathematica to solve the system as follows:

eqns = {y'[t] == -447.0 Exp[2.24 y[t]] y[t] + z[t], z'[t] == (-z[t] + 20)/0.401 , y[0] == 0, z[0] == 0} sol = NDSolve[eqns, {y, z}, {t, 0., 100.}]

Mathematica returns

{{y->InterpolatingFunction[Domain: {{0.,100.}}
Output: scalar

],z->InterpolatingFunction[Domain: {{0.,100.}}
Output: scalar

]}}

Now my question is, what can I do with this output? Can I ask Mathematica to return a function that somehow describes the output?

Thank you,

Niki

POSTED BY: Niki Nikou
2 Replies
Posted 4 years ago

Thank you very much Gianluca

That helps me a lot!

POSTED BY: Niki Nikou

The easiest way to use the results is with NDSolveValue. You can give your favourite names to the solutions and use them as ordinary functions for calculation or plotting:

eqns = {y'[t] == -447.0 Exp[2.24 y[t]] y[t] + z[t], 
   z'[t] == (-z[t] + 20)/0.401, y[0] == 0, z[0] == 0};
{solX, solZ} = NDSolveValue[eqns, {y, z}, {t, 0., 100.}]
solX[3]
Plot[solZ[t], {t, 0, 40}, PlotRange -> All]
ParametricPlot[{solX[t], solZ[t] - 20}, {t, 0, 40}, AspectRatio -> 1]
POSTED BY: Gianluca Gorni
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