How do I plot colored temperature distribution on a rectangular plate?

4 次查看(过去 30 天)
I have the data for temperature at every point and I want continuous colored plot corresponding to each temperature. Say, red for 100 degC and blue for 0 degC.

采纳的回答

buzz
buzz 2015-4-7
Let's suppose "plate" is the temperature distribution.
[M,N] = size(plate);
%Pay attention:
% M --> raws N --> coloumns
%BUT for meshgrid you must introduce (x,y) coordinates, so:
% M --> y N--> x
[x,y] = meshgrid(1:N,1:M);
surf(x,y,plate);
If plate would exceed [0-100] bounds, you could use a support variable:
plate_2 = plate;
plate_2(plate_2>100) = 100;
plate_2(plate_2<0) = 0;
surf(x,y,plate_2);
  2 个评论
Shubham Maurya
Shubham Maurya 2015-4-7
r=-5:.2:5; [X,Y]=meshgrid(r,r); Z=30-2*X; pcolor(Z) Suppose, I want to label each color in the plot. How to do it?
Shubham Maurya
Shubham Maurya 2015-4-7
r=-5:.2:5;
[X,Y]=meshgrid(r,r);
Z=30-2*X;
pcolor(Z)
I want to label each color in the plot. How to do it. Thanks

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by