Area in 3-D temperature plot

조회 수: 2 (최근 30일)
Tyler Menz
Tyler Menz 2020년 5월 20일
댓글: Star Strider 2020년 5월 21일
Hello,
I have a set of oceanographic data with longitude, depth, and temperature. I've used contour3 to make a 3-D image of the data. Now I would like to find the area within the 6-8 deg C temperature range. Is there any way to do this withing Matlab? This is the code I've been using. Thank you!
load 'upcast';
lat = upcast(:,2);
long = upcast(:,3);
depth = upcast(:,4);
temp= upcast(:,5)
x = (upcast(:,3)); %long
y = (upcast(:,4)); %depth
z = (upcast(:,5)); %temp
xv = linspace(min(x),max(x));
yv = linspace(min(y),max(y));
[X,Y] = meshgrid(xv,yv);
Z = griddata(x,y,z,X,Y);
figure
contour3(X,Y,Z);
hold on
surf(X,Y,Z);
axis ij;
ylim ([0 100]);
colorbar
colormap 'jet'
grid off

채택된 답변

Star Strider
Star Strider 2020년 5월 20일
Apparently, the contour3 call plots temperature contours as a function of longitude and depth. You can specify the levels at which you want the contours to be drawn: Contours at Specific Levels with Labels and also do that in a separate contour call if necessary to get only those specific levels.
The first output ‘M’ is the contour (x,y) coordinates (that here would be longitude and depth, see: M for details) that you can then use with trapz to get the areas.
  댓글 수: 6
Tyler Menz
Tyler Menz 2020년 5월 21일
Seems to be working! Thank you so much!
Star Strider
Star Strider 2020년 5월 21일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by