Plotting a line between two points
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am writing a script to simulate a mechanism. I am up to a point where I have x and y co-ordinates for each of the joints. I now need to plot lines between each point, for example between O2 and A. I attempted to put the x and y co-ordinates of each point into a matrix, but was having difficulties with that. Does anyone have any suggestions? Cheers.
O2_x(i) = 0;
O2_y(i) = 0;
A_x(i) = (link_2*cos(theta_2(i)));
A_y(i) = (link_2*sin(theta_2(i)));
B_x(i) = (A_x(i) + (link_3*cos(theta_3(i))));
B_y(i) = (A_y(i) + (link_3*sin(theta_3(i))));
O4_x(i) = 3.79;
O4_y(i) = 0;
0 comentarios
Respuestas (2)
Mischa Kim
el 23 de Mzo. de 2014
Editada: Mischa Kim
el 23 de Mzo. de 2014
Scott, did you try it this way?
xi = [O2_x(i) A_x(i) B_x(i) O4_x(i)];
yi = [O2_y(i) A_y(i) B_y(i) O4_y(i)];
plot(xi, yi)
For two points you'd use
xi = [O2_x(i) A_x(i)];
yi = [O2_y(i) A_y(i)];
1 comentario
Mischa Kim
el 23 de Mzo. de 2014
Check out:
x = 0:0.1:pi;
y = sin(x);
t = 0:0.1:10;
for ii = 1:numel(t)
plot(x,y*sin(t(ii)))
axis equal
ylim([-1 1])
F(ii) = getframe;
end
Please add follow-up questions and comments as comments, not answers.
Ver también
Categorías
Más información sobre Annotations 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!