Make a point move straight up and down
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I would like to know how to plot a point and just make it go up, down, and back to the starting point. I was thinking about making a list of y values but was not sure if there was a simpler way.
Thanks
댓글 수: 0
답변 (2개)
Sulaymon Eshkabilov
2020년 8월 15일
Hi,
A simple motion or animation tool with plot tools is drawnow that can be employed in your task, e.g.:
Sulaymon Eshkabilov
2020년 8월 15일
Hi,
If I've understood your question correctly, you'd like to get a up and down motion of a point x, y(i). Then here is one of the possible animated plots with drawnow:
for ii=1:numel(x) %loop
plot(x,y, '--', px, y(ii),'o', 'markerfacecolor', 'y'); %circle point
hold off
drawnow
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!