How to create an animation between 2 points

조회 수: 2 (최근 30일)
Yu-Wei Tu
Yu-Wei Tu 2021년 5월 10일
댓글: Yu-Wei Tu 2021년 5월 10일
Hi! I want to make animation of a line between 2 points. Let's say point 1 is (0,0) and point 2 is (5,4). How can I create an animate line between them and plot the final point(b) in the plot as well?

채택된 답변

KSSV
KSSV 2021년 5월 10일
A = [0 0] ;
B = [5 4] ;
x = [A(1) B(1)] ;
y = [A(2) B(2)] ;
p = polyfit(x,y,1) ;
xi = linspace(x(1),x(2)) ;
yi = polyval(p,xi) ;
comet(xi,yi)
plot(x,y,'*r',xi,yi,'b')
  댓글 수: 3
KSSV
KSSV 2021년 5월 10일
Read about axis
Yu-Wei Tu
Yu-Wei Tu 2021년 5월 10일
Solved! Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by