필터 지우기
필터 지우기

Surf plot: Data dimensions must agree.

조회 수: 4 (최근 30일)
Duncan Wright
Duncan Wright 2017년 11월 5일
답변: Star Strider 2017년 11월 5일
Can't for the life of me figure this out..
trying to plot the following:
surf(transect1.lon,transect1.lat,transect1.z,transect1.u)
They have the following dimensions:
size(transect1.lon) = 29 1
size(transect1.lat) = 29 1
size(transect1.z) = 29 30
size(transect1.u) = 29 30

채택된 답변

Star Strider
Star Strider 2017년 11월 5일
Either ‘transect1.lon’ or ‘transect1.lat’ has to be (30x1), or you have to remove one column from ‘transect1.z’ and ‘transect1.u’ so the dimensions match. (An option is to interpolate the matrices to make them both (29x29), or interpolate one of the vectors to (30x1).)
The surface plots only take one matrix argument, so you have to use hold to plot both in the same axes.
After you make sure the vectors and matrix dimensions match, see if this does what you want:
figure
surf(transect1.lon,transect1.lat,transect1.z)
hold on
surf(transect1.lon,transect1.lat,transect1.u)
hold off
grid on
NOTE I can’t run your code to test this, so this is UNTESTED CODE.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by