Clear Filters
Clear Filters

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

3 views (last 30 days)
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 ?

Accepted Answer

Voss
Voss on 14 Mar 2024
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 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!