Plot two surfaces each with different color

23 visualizaciones (últimos 30 días)
Samuel
Samuel el 4 de Abr. de 2018
Comentada: Star Strider el 4 de Abr. de 2018
I want to plot a surface with green color on another surface with red color such that the grids will be transparent. How can I achieve this in Matlab?

Respuesta aceptada

Star Strider
Star Strider el 4 de Abr. de 2018
I’m not certain what you want.
Try this:
[X,Y] = meshgrid(linspace(-2, 2, 50));
Z = @(x,y,c) x.^2 + y.^2 + c;
figure(1)
surf(X, Y, +Z(X,Y,-4), 'FaceColor','g', 'FaceAlpha',0.5, 'EdgeColor','none')
hold on
surf(X, Y, -Z(X,Y,-4), 'FaceColor','r', 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
grid on
  4 comentarios
Samuel
Samuel el 4 de Abr. de 2018
Thank you so much, Star. This is exactly what I want.
Star Strider
Star Strider el 4 de Abr. de 2018
My pleasure.
If my Answer helped you solve your problem, please Accept it!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Green 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