>> colormap cool
>> z=peaks(25);
h=surf(z);rotate(h,[1,1,1],30,[1,1,1]);
colormap cool
3)Colordef 指令的使用
设置图形背景颜色
rotate(h,[1,1,1],90,[1,1,1]);
>> subplot(2,2,1);colordef none;surf(peaks(35));
>> subplot(2,2,2);colordef black;surf(peaks(35));
>> subplot(2,2,3);colordef white;surf(peaks(35));
4)Colormap 方法
Colormap 制定用于设置图形的颜色。该颜色映像采用 rgb 色系。
>>surf(peaks(100))
>> colormap(cool(3));
>> colormap(autumn)
5)Shading 方法
Shading 用于对 mesh,surf,等船舰的图形非数据处着色。Shading 的形式
Shading flat 使用平滑的方式着色,整个贴片都是一种颜色。
Shading interp 使用插值的方式为图形着色。
Shading faceted 以平面为单位着色,在着色的周围用黑色的网线勾勒。
>> t=0:pi/5:4*pi;
>> [x,y,z]=cylinder(2+sin(t));
>> subplot(2,2,1);surf(x,y,z);shading interp;
>> subplot(2,2,2);surf(x,y,z);shading flat;
>> subplot(2,2,3);surf(x,y,z);shading faceted;
6)Light 方法
设定照明的效果
surf(peaks);light('color','r','Position',[0 1 0],'Style','local');
7)Lighting 命令
可以显示不同的照明模式,lighting 命令必须在 light 之后才能起作用。
>> t=0:pi/20:2*pi;
>> [x,y,z]=cylinder(2+cos(t));
>> subplot(2,2,1);mesh(x,y,z);light;lighting phong;
>> subplot(2,2,2);surf(x,y,z);light;shading faceted;lighting flat;
>> subplot(2,2,3);surf(x,y,z);light;lighting gouraud;
>> subplot(2,2,4);mesh(x,y,z);light;lighting none;
8)Material 指令
Material 指令控制光照的效果和材质,也可设置图形表面对光照反射的模式。
Material option option 的选项包括 shiny 对想比较明亮,镜反射份额较大,反射光
的颜色取决预光源的颜色
surf(peaks);shading flat;material shiny;
9)Surfl 指令
Surfl 用于带光照的三维表面图
subplot(1,2,1),surfl(peaks,[30,50]),shading interp
1