How to color Gaussian 3D plot with shiny texture?

조회 수: 6 (최근 30일)
wndud77
wndud77 2024년 2월 12일
댓글: wndud77 2024년 2월 12일
Hi,
I tried to plot the Gaussian peak with Matlab.
From the wikimedia, I found the Matlab code for Gaussian like below:
https://commons.wikimedia.org/wiki/File:Gaussian_2d.png#file
[X, Y] = meshgrid(-30:.1:30, -30:.1:30);
Z = exp(-X.^2-Y.^2);
surf(X,Y,Z);
shading interp;
view(-56,56)
And this gave me the plot like below.
Is there any way to make this plot with shiny material like this?:
Thanks in advance.

채택된 답변

Matt J
Matt J 2024년 2월 12일
편집: Matt J 2024년 2월 12일
[X, Y] = meshgrid(-3:0.1:+3);
Z = exp(-X.^2-Y.^2);
surf(X,Y,Z,'FaceColor',[0.6 0.1800 0.700],'EdgeColor','none');
light(Position=[2,-3 0.5]);
material shiny
view(-56,56)
  댓글 수: 3
Matt J
Matt J 2024년 2월 12일
Glad it worked, but you should upgrade your Matlab version if you can.
wndud77
wndud77 2024년 2월 12일
Agree. Mine is R2020b so I thought probably my version is too old for your code.

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

추가 답변 (0개)

카테고리

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