A moving line plot in MATLAB figure with animation between 3 points
39 views (last 30 days)
Rajawarman Thiruselvam on 5 Jul 2021
Hi everyone, I need help to do an animated line for known coordinates
for example :(x1,y1)=(2,1)
simply i can plot these lines , but don't know how to animate from one point to another point. How can i do this??
Johannes Hougaard on 6 Jul 2021
Could be something like this then...
It's super inefficient code and can definitely be improved in speed as well as complexity.
x = [2 3 4];
y = [1 2 2];
totaltime = seconds(10);
steptime = totaltime/length(x);
for ii = 1:length(x)-1
npoints = 999;
pointsx = linspace(x(ii),x(ii+1),npoints);
pointsy = linspace(y(ii),y(ii+1),npoints);
for jj = 1:npoints
More Answers (1)
Srijan Jain on 5 Jul 2021