I am trying to plot a heat map of temperature along depth and time. However the plot does not match the provided data. For instance at z = -8612 m I have T = 80.57°C, but it would be something near 165°C.
I attached my .mat files, the depth, time and temperature data. My code to plot is:
% Plotting
figure;
imagesc(time, depth, temp);
colormap('jet');
colorbar;
xlabel('Time');
ylabel('Depth');
title('Temperature Heat Map');
set(gca, 'YDir', 'normal');
Could someone please give me any idea of what is happening here?
Thanks!

 채택된 답변

Voss
Voss 2024년 3월 11일
편집: Voss 2024년 3월 11일

0 개 추천

The difference between adjacent elements of depths is not constant. (Same for time.)
load depth
load temp
load time
% difference between adjacent elements of depths:
disp(diff(depths.'))
Columns 1 through 33 -211 -200 -190 -180 -170 -160 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 34 through 66 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 67 through 99 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 100 through 132 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 133 through 165 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -20 -30 -40 -50 -60 -70 -80 -90 -100 -110 -120 -130 -140 -150 -160 -170 -180 -190 -200 -210 -220 -230 -240 Columns 166 through 170 -250 -260 -270 -280 -292
An image uses equally-sized pixels, so it's not an appropriate choice to represent data like this where the x- and y- spacing is not constant.
Better is to use a surface:
surface(time, depths, temperature, 'EdgeColor', 'none')
xlim(time([1 end]))
ylim(depths([end 1]))
colormap('jet');
colorbar;
xlabel('Time');
ylabel('Depth');
title('Temperature Heat Map');
set(gca, 'YDir', 'normal');

댓글 수: 2

Williams
Williams 2024년 3월 11일
Perfect!! Many thanks for the solution!!
Voss
Voss 2024년 3월 11일
You're welcome!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2024년 3월 11일

댓글:

2024년 3월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by