5

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.

enter image description here

jarhead
  • 2,065
  • 12
  • 19

1 Answers1

16

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 under the Arrowheads to adjust the number and position of the arrows:

enter image description here

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:

enter image description here

Have fun!

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96