How to animate a moving figure in matlab?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to know how to perform animation of a moving figure using matlab. I know to perform animation of points movement in a plot but I need to know to animate the figure which moves based on center point of a figure. For example I provide some moving commands to center of circle, based on movement of that point the circle should be able to move. Is it possible using matlab. Please let me know. Thank you.
0 comentarios
Respuestas (1)
KSSV
el 6 de Sept. de 2017
c = [0 0] ; % center of circle
th = linspace(0,2*pi) ;
r = 0.1;
x = c(1)+r*cos(th) ;
y = c(1)+r*sin(th) ;
h = plot(x,y,'r') ;
axis equal
%%animation
for i = 1:100
c = rand(1,2) ; % center of circle
x = c(1)+r*cos(th) ;
y = c(1)+r*sin(th) ;
set(h,'XData',x,'YData',y) ;
axis([-2 2 -2 2])
drawnow
end
2 comentarios
KSSV
el 7 de Sept. de 2017
Yes you just referred a circle....what you want is very much possible. If your concept is not clear with above example..show us pictorial example of what you expect..
Ver también
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!