how to make drawnow for this figure

11 visualizaciones (últimos 30 días)
polo Mahmoud
polo Mahmoud el 18 de Mzo. de 2020
Comentada: Devineni Aslesha el 26 de Mzo. de 2020
Hi
How do i make my figure plot from this to its negative point, so the figure goes back and forward ( the red line on the uploaded figure) in an animated figure:
figure
plot3(x_coor,z_coor,y_coor,'k','HandleVisibility','off');
hold on;
plot3(Px_coor,Pz_coor,Py_coor,'r','HandleVisibility','off');
x_coor = [0 1 2 3 4 5
1 2 3 4 5 6]
y_coor = [0 0 0 0 0 0
0 0 0 0 0 0]
z_coor = [0 0 0 0 0 0
0 0 0 0 0 0]
Px_coor = [0 1 2 3 4 5
1 2 3 4 5 6]
Pz_coor = [0 0 0 0 0 0
0 0 0 0 0 0]
Py_coor = [0 0.0225501852619405 0.0827680826631456 0.169761552175099 0.273470524612610 0.385480815448938
0.0225501852619405 0.0827680826631456 0.169761552175099 0.273470524612610 0.385480815448938 0.500000000000000]

Respuestas (1)

Devineni Aslesha
Devineni Aslesha el 24 de Mzo. de 2020
To animate the red line shown in the attached figure, use the below code. Here, pause is used instead of draw to notice that the animation took place.
h = animatedline;
for t = 1:length(Px_coor)
addpoints(h,Px_coor(1,t),Pz_coor(1,t),Py_coor(1,t));
pause(0.5);
end
For more information, refer the following links.
  4 comentarios
polo Mahmoud
polo Mahmoud el 26 de Mzo. de 2020
Hi I wanted the red line go from 0.5 to -0.5 i the y-axis on the figure I uploaded. Such that it simulated the first modeshape of a canteliver beam
Devineni Aslesha
Devineni Aslesha el 26 de Mzo. de 2020
Change the coordinates from the code below to move the red line from 0.5 to -0.5 in the y-axis.
x_coor = [0 1 2 3 4 5];
y_coor = [0 0 0 0 0 0];
z_coor = [0 0 0 0 0 0];
Px_coor = [0 1 2 3 4 5 5 4 3 2 1 0];
Pz_coor = [0 0 0 0 0 0 0 0 0 0 0 0];
Py_coor = [0 0.0225501852619405 0.0827680826631456 0.169761552175099 0.273470524612610 0.385480815448938 -0.385480815448938 -0.27347052461261 -0.169761552175099 -0.0827680826631456 -0.0225501852619405 0];
figure(1)
plot3(x_coor,z_coor,y_coor,'k','HandleVisibility','off');
hold on;
h = animatedline;
for t = 1:length(Px_coor)
addpoints(h,Px_coor(1,t),Pz_coor(1,t),Py_coor(1,t));
pause(0.8);
end

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by