Plotting a colored surface in 2D

159 visualizaciones (últimos 30 días)
Johnson
Johnson el 26 de Dic. de 2014
Comentada: Yinghui Hu el 18 de Ag. de 2023
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

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 26 de Dic. de 2014
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 comentarios
Johnson
Johnson el 26 de Dic. de 2014
Thanks a lot Azzi !
Ahmad Asghar
Ahmad Asghar el 5 de Nov. de 2018
View(2) ignores the last row and col. Any idea how to avoid that? Appending a zero row and col is not working :)

Iniciar sesión para comentar.

Más respuestas (3)

Abdullah Talib
Abdullah Talib el 14 de Nov. de 2018
you can also use
imagesc(x,y,u); colormap jet; axis xy;
  2 comentarios
yogendra jaiswara
yogendra jaiswara el 2 de Oct. de 2022
Nice
Yinghui Hu
Yinghui Hu el 18 de Ag. de 2023
it is a great help. Just what I would like to have!

Iniciar sesión para comentar.


Vijendra Singh
Vijendra Singh el 21 de Dic. de 2020
syms x y y=sin(x) ezplot(x,y)

Gul Rahman Abdulrahimzai
Gul Rahman Abdulrahimzai el 18 de Nov. de 2022
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

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by