필터 지우기
필터 지우기

Error using surf (line 71) Data dimensions must agree

조회 수: 6 (최근 30일)
Hélène Parisot-Dupuis
Hélène Parisot-Dupuis 2023년 11월 28일
댓글: Walter Roberson 2023년 11월 28일
Hello,
I have the kind of problem with my code and I don't understand why:
for it=1:2
xt(it,1)=it
for jt=1:3
yt(1,jt)=jt
zt(it,jt)=it+(jt-1)
end
end
figure;
surf(xt,yt,zt,'EdgeColor', 'None', 'facecolor', 'interp');
view(2);
colormap(jet(256));
c = colorbar;
Could you help me to find my error please?
Thanks in advance!

답변 (1개)

Alan Stevens
Alan Stevens 2023년 11월 28일
More like this?
for it=1:2
for jt=1:3
zt(it,jt)=it+(jt-1);
end
end
[x,y] = meshgrid(1:3,1:2);
figure;
surf(x,y,zt,'EdgeColor', 'None', 'facecolor', 'interp');
view(2);
colormap(jet(256));
c = colorbar;
  댓글 수: 4
Hélène Parisot-Dupuis
Hélène Parisot-Dupuis 2023년 11월 28일
Thank you very much for this clarification!
Voss
Voss 2023년 11월 28일
You're welcome!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by