How to plot a matrix in a 3D plot in matlab
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a 3D vector which I am using to store various values. I want to take these values and plot them as points in a 3D plot, how can I do so?
댓글 수: 1
the cyclist
2023년 8월 9일
How, specifically, are the data stored? Are they in an Nx3 matrix?
Can you upload the data, or a representative sample? You can use the paper clip icon in the INSERT section of the toolbar.
답변 (1개)
DavidP
2023년 8월 9일
By "3D vector" I'm assuming you mean an Nx3 matrix in the form
N = 4; %Number of data points
x = [1, 2, 3, 4];
y = [2, 3, 1, 2];
z = [1, 3, 1, 4];
vect(1:N,1:3) = [x' y' z']
You can use the scatter3(x,y,z) function to plot these points as a scatter plot
scatter3(vect(:,1), vect(:,2), vect(:,3), 'bx') %vect(:,1) -> every row, first column
axis([0 5 0 5 0 5])
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!