필터 지우기
필터 지우기

How to plot in 3d line to multiple point from origin?

조회 수: 2 (최근 30일)
Kunal Joshi
Kunal Joshi 2018년 10월 2일
답변: Jim Riggs 2018년 10월 2일
I have a 3X3 matrix I want to plot
-0.3727 -0.4005 0.8371;
-0.1918 -0.8493 -0.4918;
0.9079 -0.3438 0.2397,
these are three points in the 3d plot. I want to plot line from origin(0 0 0) to each point in the same graph.
  댓글 수: 2
Rik
Rik 2018년 10월 2일
You can just use plot3 to plot lines. You can put in NaN values to skip segments and put in the zeros at the places you want them.
Kunal Joshi
Kunal Joshi 2018년 10월 2일
Thanks your suggestion helped.

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

답변 (1개)

Jim Riggs
Jim Riggs 2018년 10월 2일
How about this:
A = 3x3 matrix
figure;
for i=1:3
px=[0, A(i,1)];
py=[0, A(i,2)];
pz=[0, A(i,3)];
if i>1
hold on;
end
plot3(px,py,pz,'r');
end
grid on;

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by