Connecting points in 3D using plot3
66 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
Suppose I have three points:
A=[1 1 1];
B=[2 2 2];
C=[3 3 3];
and suppose that I want to draw black lines connecting point A to point B to point C (in that order). How can I do this? If I try the following,
plot3(A,B,C,'k.')
this is not the correct syntax, it seems. Can you please help me see what I am doing wrong? Thank you very much.
Andrew DeYoung
Carnegie Mellon University
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 3 Jun. 2011
That's because {A,B,C} the way you've called it reference the same point!
I think you want:
A=[1 2 3];
B=[1 2 3];
C=[1 2 3];
plot3(A,B,C,'k-')
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 3 Jun. 2011
xyz = vertcat(A,B,C);
plot3(xyz(1,:),xyz(2,:),xyz(3,:),'k.');
0 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!