The Beautiful Future

matlab 그래프 포인트 움직이기 본문

스킬

matlab 그래프 포인트 움직이기

Small Octopus 2016. 9. 1. 14:35

a = [41.50,   -70.95];

 b = [ 41.80 , -70.50];

 % straight line function from a to b

 func = @(x)a(2) + (a(2)-b(2))/(a(1)-b(1))*(x-a(1));

 % determine the x values

 x = linspace(a(1),b(1),50);

 % determine the y values

 y = func(x);

 % create the figure

 figure;

 % get a handle to a plot graphics object

 hPlot = plot(NaN,NaN,'ro');

 % set the axes limits

 xlim([min(a(1),b(1)) max(a(1),b(1))]);

 ylim([min(a(2),b(2)) max(a(2),b(2))]);

 % iterate through each point on line

 for k=1:length(x)

     % update the plot graphics object with the next position

     set(hPlot,'XData',x(k),'YData',y(k));

     % pause for 0.5 seconds

     pause(0.5);

 end

'스킬' 카테고리의 다른 글

caffe locally connected layer  (0) 2016.09.17
sse add mul  (0) 2016.09.04
vtk 설치 win8.1  (0) 2016.08.06
install python on windows  (0) 2016.07.26
windows에서 digits objdetction 삽질 실패  (0) 2016.07.05
Comments