Effacer les filtres
Effacer les filtres

How to color Gaussian 3D plot with shiny texture?

5 vues (au cours des 30 derniers jours)
wndud77
wndud77 le 12 Fév 2024
Commenté : wndud77 le 12 Fév 2024
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.

Réponse acceptée

Matt J
Matt J le 12 Fév 2024
Modifié(e) : Matt J le 12 Fév 2024
[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 commentaires
Matt J
Matt J le 12 Fév 2024
Glad it worked, but you should upgrade your Matlab version if you can.
wndud77
wndud77 le 12 Fév 2024
Agree. Mine is R2020b so I thought probably my version is too old for your code.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by