Plot two surfaces each with different color

조회 수: 24 (최근 30일)
Samuel
Samuel 2018년 4월 4일
댓글: Star Strider 2018년 4월 4일
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?

채택된 답변

Star Strider
Star Strider 2018년 4월 4일
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
Samuel
Samuel 2018년 4월 4일
Thank you so much, Star. This is exactly what I want.
Star Strider
Star Strider 2018년 4월 4일
My pleasure.
If my Answer helped you solve your problem, please Accept it!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Green에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by