MATLAB画半球程序为[R,Fia,Theta]=meshgrid(0:0.1:15,0:0.1:0.5*pi,0:0.2:2.1*pi); x=R.*sin(Fia).*cos(Theta); y=R.*sin(Fia).*sin(Theta);z=R.*cos(Fia);surf(x,y,z,'edgecolor','none')但运行时总有错误,CData must be an M-by-N matrix or M-by-N-by-
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/28 04:31:24
MATLAB画半球程序为[R,Fia,Theta]=meshgrid(0:0.1:15,0:0.1:0.5*pi,0:0.2:2.1*pi); x=R.*sin(Fia).*cos(Theta); y=R.*sin(Fia).*sin(Theta);z=R.*cos(Fia);surf(x,y,z,'edgecolor','none')但运行时总有错误,CData must be an M-by-N matrix or M-by-N-by-
MATLAB画半球
程序为[R,Fia,Theta]=meshgrid(0:0.1:15,0:0.1:0.5*pi,0:0.2:2.1*pi);
x=R.*sin(Fia).*cos(Theta);
y=R.*sin(Fia).*sin(Theta);
z=R.*cos(Fia);
surf(x,y,z,'edgecolor','none')但运行时总有错误,CData must be an M-by-N matrix or M-by-N-by-3 array.
Error in ==> surf at 81
hh = double(graph3d.surfaceplot(args{:},'parent',cax)); 小弟初学MATLAB,
MATLAB画半球程序为[R,Fia,Theta]=meshgrid(0:0.1:15,0:0.1:0.5*pi,0:0.2:2.1*pi); x=R.*sin(Fia).*cos(Theta); y=R.*sin(Fia).*sin(Theta);z=R.*cos(Fia);surf(x,y,z,'edgecolor','none')但运行时总有错误,CData must be an M-by-N matrix or M-by-N-by-
注意matlab的surf只能画曲面不能绘制三维实体,试试下面的代码
R=15;
Fia=0:0.01:pi;
Theta=0:0.02:2.1*pi;
x=R*sin(Fia)'*cos(Theta);
y=R*sin(Fia)'*sin(Theta);
z=(R^2-x.^2-y.^2).^(1/2);
surf(x,y,z,'edgecolor','none')
axis equal
axis off