MATLAB: How to color a mesh by temperature(or other value) preserving the elevation. Using two matrix(same length)

3d plotscolormapelevationMATLABmeshtemperaturatemperaturetopographic

I have a mesh that plots a terrain with values in a matrix Z(NxN), i need to color this whit the temperature value in every heigth set in another matrix with same length T(NxN) preserving the corresponding elevation.So my problem is that it only colors depending on the height.untitled.jpg

Best Answer

% dummy data
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X).*cos(Y);
T = X+Y;
% plot
surf(X,Y,Z,T)
colormap('hot')
colorbar