3
$\begingroup$

I have the following in Mathematica:

xx = {1, 2, 3, 4, 5, 6, 7, 8, 9};
yy = {10, 20, 30, 40, 50, 60, 70, 80, 90};
xy = Transpose[{xx, yy}] // Partition[#, 3] &;
ani = ListPlot[#] & /@ xy;
Animate[ani]

The above code gives me a nice animation. But I want to draw an arrow and want it to move in a synchronous way with the animation. For drawing arrow I am using:

Animate[Graphics[Arrow[{{0, 0}, {xx[[i]], yy[[i]]}}]], {i, 1, Length[xx], 1}];

How can both the animations be displayed on same figure and in a synchronous manner? Thanks in advance. Here is a link to a .gif file which I generated in MATLAB. I am trying something like this on Mathematica:

$\endgroup$
  • $\begingroup$ @RunnyKine Here is the new question. I have also provided link to a .gif which I am hoping to generate. Thanks for your help. $\endgroup$ – Brato Oct 2 '14 at 7:20
3
$\begingroup$

I post this for illustrative purposes (without attempting to exactly reproduce).[if can be be controlled by one parameter or function of parameter]:

Manipulate[
 Column[{
   Plot[Exp[-(t + p)^2], {t, -3 - p, 3 - p}, 
    PlotRange -> {{-8, 3}, {0, 1}}, Frame -> True],
   ParametricPlot[RotationMatrix[p].{t , t^2}, {t, -1, 1}, 
    Axes -> False, PlotRange -> {{-4, 2}, {-2, 2}}, 
    Epilog -> {{Arrow[{{-3, 0}, {-3, -1}}]}, 
      Arrow[{{-3, 0}, {-3, 0} + {Cos[p], -Sin[p]}}]}]
   }],
 {p, 0, 2 Pi}]

To export (gif or mov etc) just change head to Table and choose suitable step size.

enter image description here

$\endgroup$
  • $\begingroup$ +1, I'd like to know that how to generate the dynamical graphic that you dragthe parameter bar. $\endgroup$ – xyz Oct 2 '14 at 11:16
  • 1
    $\begingroup$ @Tangshutao this is just a screen capture of Manipulate object. I use: LiceCap: licecap.en.softonic.com You may have your own favourite. $\endgroup$ – ubpdqn Oct 2 '14 at 12:09
  • $\begingroup$ ,Ok, I see.thanks sincerely! :-) $\endgroup$ – xyz Oct 2 '14 at 12:12
  • $\begingroup$ +1 For the interesting use of RotationMatrix. $\endgroup$ – DavidC Oct 2 '14 at 12:30
  • $\begingroup$ @ubpdqn Thank you for your answer. I am sorry for my late reply. Your solution works perfectly for the case you have shown. But what happens if I have {x,y} points from array instead of having it from manipulate both for arrows and the curve. How can I use manipulate then? $\endgroup$ – Brato Oct 2 '14 at 19:16

Your Answer

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

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