分析代码如下:% Using hgtransformfigure ax = axes; [x,y,z] = sphere(270);% Transform object contains the surfacegrp = hgtransform('Parent',ax); s = surf(ax,x,y,z,z,'Parent',grp,...
'EdgeColor','none');
view(3) grid onaxis vis3d% Apply the transformticfor ang = linspace(0,2*pi,360)
tm = makehgtform('axisrotate',[1,1,1],ang);
grp.Matrix = tm;
drawnowendtoc
工具/原料
1
电脑
2
matlab软件
方法/步骤
1
figure 通过这个函数,我们能够得到图像的背景。
2
ax = axes; axes这个函数给出了我们图像中的坐标轴。
3
[x,y,z] = sphere(270);生成了x,y,z三个271×271的矩阵。
4
% Transform object contains the surfacegrp = hgtransform('Parent',ax); h=hgtransform('PropertyName',property value,…)使用参数列表中指定的属性值设置创建转换对象。有关属性的说明,请参见变换属性。
5
s = surf(ax,x,y,z,z,'Parent',grp,... 'EdgeColor','none'); 通过surf函数进行画图。
6
view(3) %视图(3)设置默认的三维视图,az=-37.5,el=30。
7
grid onaxis vis3d% Apply the transform
8
tic%tic启动秒表计时器来测量性能。函数记录执行tic命令时的内部时间。
9
for ang = linspace(0,2*pi,360) tm = makehgtform('axisrotate',[1,1,1],ang); grp.Matrix = tm; drawnowend
10
toc%使用toc功能显示经过的时间。
下一篇:澳大利亚商标注册申请的方法