3
$\begingroup$

A point is on one side of a regular polygon, and the regular polygon rotates at a constant speed. How can I draw the change curve of the vertical coordinate of the point with time?

enter image description here

$\endgroup$
4

1 Answer 1

3
$\begingroup$

How it exactly should rotate is not clear to me (still image), but here is my interpretation of doing it:

ClearAll[func,regpolygon]
func[θ_]:={Cos[θ],Sin[θ]}
regpolygon[n_][θ_]:=func[θ] Cos[Pi/n]/Cos[(2Pi)/n ((θ n)/(2Pi)-Floor[(θ n)/(2Pi)])-Pi/n]
MakeScene[θ_,f_]:=Module[{plog,t,p1,pt0,pt1,pt2},
plog=ParametricPlot[f[t]-{1,0},{t,0,2Pi},PlotStyle->Red];
pt0={-1,0};
pt1=f[θ]-{1,0};
pt2={0,f[θ][[2]]};
p1=Plot[f[t+θ][[2]],{t,0,2Pi},PlotRange->{{-2.1,2Pi},{-1.05,1.05}},AspectRatio->Automatic,Epilog->{Red,Line[{pt0,pt1,pt2}],Point[{pt0,pt1,pt2}]},PlotStyle->Red];
Show[{p1,plog}]
]
Manipulate[MakeScene[t,regpolygon[n]],{{n,5},3,10,1},{t,0,2Pi}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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