
How can I paint a surface according to another scalar function?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Johnson
el 9 de En. de 2016
Comentada: Mike Garrity
el 11 de En. de 2016
Dear experts,
Assume I am given with the surface: z=4-x-y^2 . I now want every point on the surface to be colored according to a function: R(x,y,z).
Is there any simple way to make such a coloring?
Thanks a lot in advance!
0 comentarios
Respuesta aceptada
Mike Garrity
el 11 de En. de 2016
Something like this?
[x,y] = meshgrid(linspace(-2,2,50));
z = 4-x-y.^2;
c = x.^2 - y;
surf(x,y,z,c)

2 comentarios
Mike Garrity
el 11 de En. de 2016
No, the 3rd argument (z) gets turned into the Z coordinate, and the 4th argument (c) gets turned into a color value. If you do this:
colorbar
You'll get a colorbar which shows the relationship between the values in c and the colors that are used for each point on the surface.
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!