Why can't I generate a sphere with a material?

2 次查看(过去 30 天)
Hi!
The following is my code. I intended to generate a sphere with a material shiny but I could't make it. Can anyone to tell me what lines I need to put in or modify?
Thank you.
[X,Y,Z]= sphere;
x2 = X.*50;
y2 = Y.*50;
z2 = Z.*50;
h = surf(x2,y2,z2);
material shiny;
axis vis3d off
set(h,'LineWidth',1.5);
This is what I want. Shiny. But I can't make it.
sphere(50); shading flat;
light('Position',[1 3 2]);
light('Position',[-3 -1 3]);
material shiny;
axis vis3d off;

采纳的回答

DGM
DGM 2022-1-30
编辑:DGM 2022-1-30
Set up the lights.
[X,Y,Z]= sphere(20);
x2 = X.*50;
y2 = Y.*50;
z2 = Z.*50;
h = surf(x2,y2,z2);
light('Position',[1 3 2]);
light('Position',[-3 -1 3]);
material shiny;
axis vis3d off
FWIW, the default material is pretty shiny already, but you can always tweak the constants individually if you want.

更多回答(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