Error using mesh, Z must be a matrix
조회 수: 14 (최근 30일)
이전 댓글 표시
I don't know why, but z won't be registered as a martix even when it calculates it as amtrix.
x=linspace(0,4,2);
y=linspace(0,4,2);
z=sin(pi.*x).*sin(pi.*y);
mesh(x,y,z)
댓글 수: 0
채택된 답변
Mischa Kim
2014년 10월 21일
편집: Mischa Kim
2014년 10월 21일
Espen, use
x = linspace(0,4,20);
y = linspace(0,4,20);
[X,Y] = meshgrid(x,y); % create a grid of data points
Z = sin(pi.*X).*sin(pi.*Y);
mesh(X,Y,Z)
Z needs to be an n-by-m, just like X and Y.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!