Hi,
I am looking to plot 3 vectors with x,y,z components. I have tried the quiver function but havent had any luck. How can I go about plotting these vectors on the same plot?
Edit: I would like the vectors to be represented by a line, not just a point.
Thanks!
Vectors:
Vector_1 = (-0.0169 0.2023 0.9791);
Vector_2 = (0.6371 -0.7526 0.1667);
Vector_3 = (0.7706 0.1667 -0.1163);

 채택된 답변

Walter Roberson
Walter Roberson 2018년 8월 21일

2 개 추천

plot3(first(:,1), first(:,2), first(:,3), 'k*-', second(:,1), second(:,2), second(:,3), 'b^-', third(:,1), third(:,2), third(:,3), 'g>-');
legend(('first', 'second', 'third'})

댓글 수: 4

Kaden
Kaden 2018년 8월 22일
Thanks for the help! I was hoping to have the vectors be represented by a line however, not just three singular points. Is it possible to have lines extend from the three points to the origin to represent vectors? Attached is an image of what im hoping to achieve, except with three vectors.
Thanks!
Walter Roberson
Walter Roberson 2018년 8월 22일
편집: Walter Roberson 2018년 8월 22일
The image did not get attached.
plot3([0 0 0; vector_1(:,1), vector_2(:,1), vector_3(:,1)], [0 0 0; vector_1(:,2), vector_2(:,2), vector_3(:,2)])
Kaden
Kaden 2018년 8월 22일
That worked! Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2018년 8월 21일

댓글:

2018년 8월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by