How to plot dots?

7 visualizaciones (últimos 30 días)
Christine Hümmer
Christine Hümmer el 24 de Oct. de 2018
Editada: madhan ravi el 24 de Oct. de 2018
I know there has been asked similar questions, but they did not help me. I am relatively new to Matlab. I have got the following graphs and want to plot dots. The first dot should be at -5,10m, that is the following equation:
x10 = 1/2 * dx10^2/g; % distance x at v=-10m/s
The second dot should be at dx = -10m/s How can I add these fixed dots to my graph? And is it possible to stop the animation of the moving dots, when they reached dx = -10 m/s?
My complete code is attached. :-)

Respuestas (1)

madhan ravi
madhan ravi el 24 de Oct. de 2018
Editada: madhan ravi el 24 de Oct. de 2018
i=1;
'on'
while dxBall(i) >= -10
% update point & text for ball 1
plot(tball(i),xBall(i),'o')
hold on
set(hLine1, 'XData', tball(i), 'YData',xBall(i))
set(hTxt1, 'Position', [tball(i) xBall(i)], ...
'String', sprintf('%.3f,%3f)',[tball(i) xBall(i)]))
% ... and the same for ball 2
set(hLine2, 'XData', tball(i), 'YData',dxBall(i))
set(hTxt2, 'Position', [tball(i) dxBall(i)], ...
'String', sprintf('%.3f,%3f)',[tball(i) dxBall(i)]))
drawnow % force refresh
pause(DELAY) % slow down animation
i = rem(i+1,length(tball))+1; % circular increment
if ~ishandle(hLine1), break; end % in case you close the figure
end
'off'
  1 comentario
madhan ravi
madhan ravi el 24 de Oct. de 2018
just add this part at the end

Iniciar sesión para comentar.

Categorías

Más información sobre Animation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by