3d surf plot question
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a matrix
Matrix(1:10,1) = 1;
Matrix(1:10,2) = 1:10;
Matrix(11:20,1) = 2;
Matrix(11:20,2) = 1:10;
Matrix(1:20,3) = rand(20,1);
I would like to make a surface plot of this matrix and do
surf(Matrix(:,1),Matrix(:,2),Matrix(:3))
But it doesn't let me because it expects matrix (instead of vector) inputs. So i tried several meshgrid implementations
[X Y] = meshgrid(Matrix(:,1),Matrix(:,2));
Z = meshgrid(Matrix(:,3));
surf(X,Y,Z)
but they don't quite give me what i want. (which is a plot of all the values in 3d). Any ideas?
댓글 수: 0
답변 (2개)
Walter Roberson
2011년 12월 1일
scatter3(Matrix(:,1), Matrix(:,2), Matrix(:,3))
You cannot do a surface plot unless you have a 2D grid of z values.
댓글 수: 0
the cyclist
2011년 12월 1일
Did you instead have something like this in mind?
>> plot3(Matrix(:,1),Matrix(:,2),Matrix(:,3),'.')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!