Message Boards Message Boards

GROUPS:

Create an animation of planet in an elliptical orbit?

Posted 3 months ago
500 Views
|
4 Replies
|
2 Total Likes
|

I use Mathematica 7 I am trying to animate a planet (Disk in Mathematica) on an elliptical orbit whose ContourPlot is found from:

plot1=ContourPlot[x^2 + 2 y^2 == 3, {x, -1.75, 1.75}, {y, -1.75, 1.75}, 
 ContourStyle -> {Red, Thickness[0.0025]}, Frame -> False, 
Axes -> True ]

using an input from an earlier version of Mathematica, which is:

plot2=Animate[{plot1,
Graphics[{RGBColor[0, 0, 1], 
    Disk[{Sqrt[3] Sin[x], Sqrt[3/2] Cos[x]}, 0.1]}]}, {x, 0, 2 \[Pi], 
  0.3}, PlotRange -> {{-1.9, 1.9}, {-1.5, 1.5}}]

This does not work. I shall be grateful if someone could help me to find the correct code for animation for Mathematica 7

4 Replies

This code works for me. Btw these days i am reading tutorial/IntroductionToControlObjects

Animate[
 Show[
  {plot1
   , Graphics[{
     RGBColor[0, 0, 1]
     , Disk[{Sqrt[3] Sin[x], Sqrt[3/2] Cos[x]}, 0.1]
     }]
   }, PlotRange -> {{-1.9, 1.9}, {-1.5, 1.5}}
  ], {x, 0, 2 Pi, 0.3}
 ]

Thank you so much Raspi. This has been a great help. Regards. Mohammad

I think the trick is that you should use Show to combine the different graphics. See attached . nb

Attachments:

Thank you very much Hans. This has been extremely helpful. I should have thought about he Show command. Regards. Mohammad

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

Group Abstract Group Abstract