I have a 100 3D vectors created using:
V = round(rand(100,3)*2-1);
I want to plot this vector in 3D using scatter3 (scatter cloud) but I need x y z values of the vector. How do I extract the x y z values. So the code I need to run is :
x = ...;
y = ...;
z = ...;
scatter3(x,y,z)
But I don't know how to get the x y z.

 채택된 답변

Image Analyst
Image Analyst 2016년 10월 28일

0 개 추천

Extracting columns is one of the most basic things you can do in MATLAB. Do this:
V = 2 * randi(2, 100, 3) - 3;
x = V(:, 1);
y = V(:, 2);
z = V(:, 3);
scatter3(x, y, z);

댓글 수: 1

N/A
N/A 2016년 10월 28일
편집: N/A 2016년 10월 28일
thanks a lot buddy, that's the part I needed, learnt it now. I presume 1 2 3 refers to the columns of the vector.

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

추가 답변 (0개)

카테고리

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

질문:

N/A
2016년 10월 28일

편집:

N/A
2016년 10월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by