Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.9K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Point animated to follow a curve?

Posted 4 years ago

Could you help me in solving this issue. I would like making the point to follow the round sinusoidal curve, instead to turn on a circle. Here is what I wrote:

r = 5 + Sin[20 t];
curves = ParametricPlot[{r Cos[t], r Sin[t]}, {t, 0, 2 Pi}];
Animate[Show[curves, Graphics[{PointSize[Large], Point[{5 Cos[t], 5 Sin[t]}]}]], {t, 0, 2 Pi}]

Could you correct in order to make the point run along the round sinusoidal. Thank you.

POSTED BY: Georges Sardin
5 Replies
Posted 4 years ago

Most likely because of existing conflicting symbol definitions. Try ClearAll[r] or quit the kernel.

POSTED BY: Rohit Namjoshi

Ok, you obviously did not start with a fresh kernel. Evaluate:

Clear[r]

before the rest of the code.

POSTED BY: Henrik Schachner

Georges, try:

r[t_] := 5 + Sin[20 t]; 
curves = ParametricPlot[r[t] {Cos[t], Sin[t]}, {t, 0, 2 Pi}];
Animate[Show[curves, Graphics[{PointSize[Large], Point[r[t] {Cos[t], Sin[t]}]}]], {t, 0, 2 Pi}]
POSTED BY: Henrik Schachner

Henrik and Rohit, Thanks a lot.

POSTED BY: Georges Sardin

It didn't work. I got this notification: SetDelayed::write: Tag Plus in (5+Sin[20 t])[t_] is Protected. Could you or anyone still help me in making the point run along the round sinusoidal. Thank you.

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