3
$\begingroup$

I have a four dimensional dynamic system that I try to solve in Mathematica. I use the following code ;

difsol = With[{\[Sigma] = 1.8, \[Alpha] = 0.4, \[Beta] = 0.1, \[Rho] =0.01, \[Delta] = 0.05, g = -0.0026315789473684214`, rr = 0.007894736842105263}, 
dek = k'[t] == -(k[t]^\[Alpha] (r[t] s[t])^\[Beta] - \[Delta] k[t] - c[t] - g k[t]);
des = s'[t] == -(-r[t] s[t] - (-rr) s[t]);
dec = c'[t] == -(c[t]/\[Sigma] (\[Alpha] k[t]^(\[Alpha] - 1) (r[t] s[t])^\[Beta] - \[Delta] - \[Rho]));
der = r'[t] == -(r[t]/(\[Beta] - 1) (\[Alpha] c[t]/k[t] - \[Delta] (1 - \[Alpha])) + r[t]^2);]

I use NDSolveValue,

{cb, kb, rb, sb} = NDSolveValue[{dec, dek, der, des, c[0] == 0.489615554653793`, k[0] == 5.3928669787954`, r[0] == 0.007894736842105263`, s[0] == 1}, {c, k, r, s}, {t, 0, 100}]

and I plot a phase diagram on a plane (k,c)

Clear[tende];
tende = 15;
cf[t_] := cb[tende - t]
rf[t_] := rb[tende - t]
kf[t_] := kb[tende - t]
sf[t_] := sb[tende - t]

ParametricPlot[{kf[t], cf[t]}, {t, 0, tende}, AxesLabel -> {k, c}, PlotRange -> {{0, 5}, {0, 1}}, PlotStyle -> Thickness[0.01]]

This gives me numerically the optimal trajectory on the phase diagram but my question is : Is it possible to precise the directions of arrows on the phase diagram ? Thanks for any help or hints !

$\endgroup$
  • 3
    $\begingroup$ Would ParametricPlot[{kf[t], cf[t]}, {t, 0, tende}, AxesLabel -> {k, c}, PlotRange -> {{0, 5}, {0, 1}}, PlotStyle -> {Thickness[0.001], Arrowheads[ConstantArray[Medium, 5]]}] /. Line -> Arrow work for you? $\endgroup$ – J. M. will be back soon May 11 '17 at 12:59
  • $\begingroup$ @J.M. Yes, thanks a lot. $\endgroup$ – optimal control May 15 '17 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.