How to plot dots?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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. :-)
0 Commenti
Risposte (1)
madhan ravi
il 24 Ott 2018
Modificato: madhan ravi
il 24 Ott 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'
Vedere anche
Categorie
Scopri di più su Animation in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!