Group Abstract Group Abstract

Message Boards Message Boards

Create charts or animation of a Pursuit Curve?

Posted 9 years ago
Attachments:
POSTED BY: pawel kowalski
4 Replies

The syntax for Arrow has changed. Try with this:

Unit[l_] := l/Sqrt[l.l]
PursuitCurve[a_, p0_, {t_, t0_, t1_, dt_}, r_: 1., opts___] := 
  Module[{soln, curve, x, y, f, targetpath, d}, 
   soln = NDSolve[{Unit[a - {x[t], y[t]}].{x'[t], y'[t]} == 1, 
      x'[t]^2 + y'[t]^2 == 1, x[0] == p0[[1]], 
      y[0] == p0[[2]]}, {x[t], y[t]}, {t, t0, t1}];
   targetpath = ParametricPlot[a, {t, t0, t1}][[1]]; 
   curve = ParametricPlot[Evaluate[{x[t], y[t]} /. soln], {t, t0, t1},
       PlotRange -> All, AspectRatio -> Automatic, 
      PlotStyle -> Red][[1]]; d = D[a, t];
   movie = 
    ListAnimate[
     Table[Graphics[{Arrow[{a, a + r d}], {Thickness[.02], 
         targetpath}, {Dashing[{1, 1} .02], Blue, 
         Line[{pt = {x[t], y[t]} /. soln[[1]], a}]}, {Red, 
         curve}, {PointSize[.08], Point[a]}, {Blue, 
         Arrow[{pt, pt + r Unit[a - pt]}]}, {Red, PointSize[.05], 
         Point[pt]}}, opts, AspectRatio -> Automatic], {t, t0, t1, 
       dt}]]];

PursuitCurve[{0, t}, {1, -1}, {t, 0, 2, .05}, .2, 
 PlotRange -> {{-.1, 1.1}, {-1.1, 2.1}}]
POSTED BY: Gianluca Gorni
Posted 9 years ago

Thank you very much. It works!

POSTED BY: pawel kowalski
POSTED BY: Vitaliy Kaurov
Posted 9 years ago

Thank you very much. It works!

POSTED BY: pawel kowalski
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard