Plot multiple lines in 3d using x,y,z start point and x,y,z end point

27 visualizaciones (últimos 30 días)
Chris
Chris el 24 de Abr. de 2020
Editada: Star Strider el 24 de Abr. de 2020
Good day wondering if someone can point me to a couple exampls how I can take a data set with an x,y,z value for the start of a line and x,y,z value for the end of line and plot multiple lines with various start and end points similar to the below oinly straight lines. Thanks

Respuestas (1)

Star Strider
Star Strider el 24 de Abr. de 2020
Editada: Star Strider el 24 de Abr. de 2020
The function to plot them is plot3.
Try this:
startPts = rand(5,3)*10; % Columns: [x(:) y(:) z(:)]
endPts = rand(5,3)*10+50; % Columns: [x(:) y(:) z(:)]
figure
plot3([startPts(:,1) endPts(:,1)]', [startPts(:,2) endPts(:,2)]', [startPts(:,3) endPts(:,3)]')
grid
view(-60,30)
That is simply a demonstration.
EDIT — (24 Apr 2020 at 23:46)
Corrected typographical error. Added comments.

Categorías

Más información sobre Debugging and Analysis 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