This question already has an answer here:

Adding arrows in curves

1 answer

I’m trying to add arrow to a simple parametric plot I’m doing:

F=1.85;

c=1.85;

G=0.01;

sol = NDSolve[{x'[t]==v[t], v'[t]==-v[t]+c Tanh[v[t]/F]-G Sign[x[t]],x[0]==0,v[0]==0.01},{x,v},{t,0,10}];

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 0, 10}]

I’ve added the arrows. There is some similar question here in the forum,

Adding arrows in curves

however it is not with parametric plot, and works with ListPlot, I’m new in mathematica and don’t find my way with this yet, any help or guidance would be much appreciated.

=================

=================

1 Answer

1

=================

Try this:

F = 1.85;

c = 1.85;

G = 0.01;

sol = NDSolve[{x'[t] == v[t],

v'[t] == -v[t] + c Tanh[v[t]/F] – G Sign[x[t]], x[0] == 0,

v[0] == 0.01}, {x, v}, {t, 0, 10}];

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 0, 10}] /.

Line[x_] :> {Arrowheads[{0., 0.07, 0.07, 0.07, 0.}], Arrow[x]}

and play with the list unde the Arrowheads to adjust the number and position of the arrows:

or alternatively you may use the following strategy:

Show[{

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 0, 1},

PlotRange -> {-0.01, 0.01}] /.

Line[x_] :> {Arrowheads[{0.07}], Arrow[x]},

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 1, 2}],

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 2, 3}] /.

Line[x_] :> {Arrowheads[{0.07}], Arrow[x]},

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 3, 4}]

}]

giving this:

Have fun!

Thank you so much 🙂

– jarhead

Nov 11 ’15 at 12:34