Is there a command to plot unit vectors in 3D?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hui Zhang
am 25 Sep. 2017
Beantwortet: Walter Roberson
am 26 Sep. 2017
I have 3 unit vectors like (1,0,0) (0,1,0) (0,0,1), and I want to plot them in 3d with same origin. I tried command "plot3" but seems like it just link those dots for me
0 Kommentare
Akzeptierte Antwort
James Tursa
am 26 Sep. 2017
E.g.,
point1 = [1,0,0];
point2 = [0,1,0];
point3 = [0 0 1];
origin = [0,0,0];
figure;hold on;
plot3([origin(1) point1(1)],[origin(2) point1(2)],[origin(3) point1(3)],'LineWidth',5);
plot3([origin(1) point2(1)],[origin(2) point2(2)],[origin(3) point2(3)],'LineWidth',5);
plot3([origin(1) point3(1)],[origin(2) point3(2)],[origin(3) point3(3)],'LineWidth',5);
grid on;
xlabel('X');
ylabel('Y');
zlabel('Z');
set(gca,'CameraPosition',[2 2 2]);
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 26 Sep. 2017
point1 = [1,0,0];
point2 = [0,1,0];
point3 = [0 0 1];
origin = [0,0,0];
p = [origin;point1;nan(1,3);origin;point2;nan(1,3);origin;point3]
plot(p(:,1),p(:,2),p(:,3))
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!