Plotting a colored surface in 2D

156 次查看(过去 30 天)
Dear experts,
I have two vectors: x and y, and a function u(x,y) representing the temperature in the point (x,y). I want to see different temperatures as different colors, in the XY plane (see an example in the attached picture). i.e.- u will be given as color in the XY plane.
Will someone please help me understand what is the appropriate method to use in order to obtain such a plot?
Thanks in advance

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-12-26
Look at this example
x=1:0.1:4
y=1:0.1:4
[X,Y]=meshgrid(x,y)
Z=sin(X).^2+cos(Y).^2
surf(X,Y,Z)
view(2)
  2 个评论
Ahmad Asghar
Ahmad Asghar 2018-11-5
View(2) ignores the last row and col. Any idea how to avoid that? Appending a zero row and col is not working :)

请先登录,再进行评论。

更多回答(3 个)

Abdullah Talib
Abdullah Talib 2018-11-14
you can also use
imagesc(x,y,u); colormap jet; axis xy;

Vijendra Singh
Vijendra Singh 2020-12-21
syms x y y=sin(x) ezplot(x,y)

Gul Rahman Abdulrahimzai
0 <= x <= 1
3 <= y <= 4
z=a(〖xy)〗^0.7 cos⁡(ax)
Create plot. Use function surf
a=input ('a = ');
[x,y]= meshgrid(0:0.1:1,3:3.5:4);
z = a*exp(x*y)^0.7*cos(x*a);
surf(x,y,z);
What is the problem with this model plz

类别

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