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;
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!