Created
June 3, 2011 23:33
-
-
Save moorepants/1007366 to your computer and use it in GitHub Desktop.
Basic Matlab Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = 0:0.001:1000; | |
x = cos(t); | |
y = sin(t); | |
fig = figure(); | |
ax = axes(); | |
hold on | |
dot1 = plot(x(1), y(1)); | |
dot2 = plot(1.5 * x(1), 1.5 * y(2)); | |
hold off | |
set([dot1, dot2], 'Marker', '.', 'MarkerSize', 20) | |
set(dot1, 'Color', 'b') | |
set(dot2, 'Color', 'g') | |
axis([-1.5, 1.5, -1.5, 1.5]) | |
for i = 1:length(t) | |
set(dot1, 'XData', x(i), 'YData', y(i)) | |
set(dot2, 'XData', 1.5 * x(i), 'YData', 1.5 * y(i)) | |
drawnow | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment