Hi fellows, Could you tell me how to plot 3d using coodinates? For example, I have the coordinates for one point is 0.2,0.3,04 and for another point is -0.3,0.3,0.1. How can I plot them in one graph and also connect the two points?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 14일

8 개 추천

v1=[0.2,0.3 4 ],
v2=[-0.3,0.3,0.1],
v=[v2;v1];
plot3(v(:,1),v(:,2),v(:,3),'r')

추가 답변 (2개)

Shaun VanWeelden
Shaun VanWeelden 2013년 3월 14일

1 개 추천

line([x1 x2],[y1 y2],[z1 z2]) and you can put as many points as you want in each vector obviously

댓글 수: 4

Shaun VanWeelden
Shaun VanWeelden 2013년 3월 14일
That's how to draw a line in 3d, there are MANY other 3d plotting functions
xueqi
xueqi 2013년 3월 14일
but the image I got usng line is not 3d. It is still a 2 dimensions plot...
Deming Zheng
Deming Zheng 2015년 9월 10일
the line command works, you can simply use "view(az, el)" to see the 3d plot. where (AZ,EL) = view returns the current azimuth and elevation. e.g. try view(30,10) after the line command. clc clear x = line([0 1],[0,0],[0,0],'color','r'); y = line([0 0],[0,1],[0,0],'color','g'); z = line([0 0],[0,0],[0,1],'color','b'); view (30,30) grid on
Thi Minh Anh Quang
Thi Minh Anh Quang 2020년 10월 30일
편집: Thi Minh Anh Quang 2020년 10월 30일
or use
rotate3d on
to drag the axes freely

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

Noman Alam
Noman Alam 2021년 2월 17일

0 개 추천

v1=[0.2,0.3 4 ],
v2=[-0.3,0.3,0.1],
v=[v2;v1];
plot3(v(:,1),v(:,2),v(:,3),'r')

카테고리

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

태그

질문:

2013년 3월 14일

답변:

2021년 2월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by