3
$\begingroup$

I am trying to solve the following problem. I have the following constants and the differential equations.

r=1;
b=1;
c=0.01;
a=0.36;
a1=0.01;
a2=0.05;
c1=2;
c2=1;
μ=0.4;
m=0.01;
d=0.5;
e=15;
deq1 = x'[t] ==r* x[t]-b*x[t]^2-c*x[t]*y[t]-0.6*x[t]*y[t]/(a+x[t])-a1*x[t]z[t]/(e+x[t])
deq2 = y'[t] ==-μ*y[t]+0.6*x[t]*y[t]/(a+x[t])-a2*y[t]z[t]/(d+y[t])
deq3 = z'[t]==-m*z[t]+c1*a1*x[t]*z[t]/(e+x[t])+c2*a2*y[t]*z[t]/(d+y[t])
soln = NDSolve[{deq1, deq2,deq3, x[0] == 0.2, y[0] == 0.05,z[0]==0.05}, {x[t], y[t],z[t]}, {t, 0, 20000}]

But i can not create the 3D plot. Any advice?

$\endgroup$

2 Answers 2

3
$\begingroup$

One possible way

soln = NDSolveValue[{deq1, deq2, deq3, x[0] == 0.2, y[0] == 0.05, 
   z[0] == 0.05}, {x, y, z}, {t, 0, 6000}];

Mathematica graphics

ParametricPlot3D[{soln[[1]][t], soln[[2]][t], soln[[3]][t]}, {t, 0, 
  4500}, AxesLabel -> {"x(t)", "y(t)", "z(t)"}, BaseStyle -> 14, 
 PlotRange -> All]

Mathematica graphics

$\endgroup$
1
5
$\begingroup$

You can use ParametricNDSolve to control your parameter values:

soln = ParametricNDSolve[{deq1, deq2, deq3, x[0] == 0.2, y[0] == 0.05,
    z[0] == 0.05}, {x, y, z}, {t, 0, 20000}, {a, a1, a2, b, c, c1, c2,
    d, e, m, r, μ}]

enter image description here

Your 3D plot:

    ParametricPlot3D[
    Evaluate[{
          x[0.36, 0.01, 0.05, 1, 0.01, 2, 1, 0.59, 15, 0.02, 1, 0.317][t], 
          y[0.36, 0.01, 0.05, 1, 0.01, 2, 1, 0.59, 15, 0.02, 1, 0.317][t], 
          z[0.36, 0.01, 0.05, 1, 0.01, 2, 1, 0.59, 15, 0.02, 1, 0.317][t]
             } /. soln
            ], {t, 0, 10000}, PlotRange -> All, BoxRatios -> {1, 1, 1}, 
             PlotPoints -> 1000, PlotTheme -> "Web", 
             PlotStyle -> {Black, Opacity[0.3], Thickness[0.003]}
                    ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.