필터 지우기
필터 지우기

How to get heat maps (color the surface) in Matlab?

조회 수: 3 (최근 30일)
Md Sadiq
Md Sadiq 2024년 3월 14일
댓글: Voss 2024년 3월 15일
I want to develop a heat map of moisture content with color bar like the attachced picture for a rectangular box of length 73''*Width 31''.I have the moisture content from 18 locations in the box.The moisture values at these 18 locations are given with their x and y coordinates in the excel file.These maps need to be generated by using moisture content at the x& y locations and linearly interpolated values in the spacing between the locations. Can anyone help me ?

채택된 답변

Voss
Voss 2024년 3월 14일
T = readtable('heat_map.xlsx','VariableNamingRule','preserve')
T = 18×3 table
Length (x) width (y) Moisture Content (%) __________ _________ ____________________ 12 10 15 12 20 15.23 12 30 15.46 24 10 15.69 24 20 15.92 24 30 16.15 36 10 16.38 36 20 16.61 36 30 16.84 48 10 17.07 48 20 17.3 48 30 17.53 60 10 17.76 60 20 17.99 60 30 18.22 72 10 18.45
nX = numel(unique(T.(1)));
nY = numel(unique(T.(2)));
X = reshape(T.(1),nY,nX);
Y = reshape(T.(2),nY,nX);
Z = reshape(T.(3),nY,nX);
surface(X,Y,Z,'FaceColor','interp','EdgeColor','none')
colormap(flipud(turbo()))
colorbar
xlim([min(X(:)) max(X(:))])
ylim([min(Y(:)) max(Y(:))])
  댓글 수: 10
Md Sadiq
Md Sadiq 2024년 3월 15일
이동: Voss 2024년 3월 15일
Thank you very much!
Voss
Voss 2024년 3월 15일
You're welcome!

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by