菜鸟求助:matlab中surf函数画参数函数的z如何确定为矩阵?
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/08 08:46:40
菜鸟求助:matlab中surf函数画参数函数的z如何确定为矩阵?
具体程序如下:
syms alphb betab X Y Z;
rE=4226;
e=870;
alphb=linspace(-pi/6,pi/6,11);
betab=linspace(-pi/8,pi/4,10);
[Ab,Bb]=meshgrid(alphb,betab);
x=-(rE*cos(Bb)+e).*sin(Ab);
y=(rE*cos(Bb)+e).*cos(Ab);
z=rE*sin(Bb);
surf(X,Y,Z)
运行时总是提示Zmust be a matrix, not a scalar or vector.
查看workspace,z确实为10*11double型矩阵,请各位大侠帮忙修改~~
具体程序如下:
syms alphb betab X Y Z;
rE=4226;
e=870;
alphb=linspace(-pi/6,pi/6,11);
betab=linspace(-pi/8,pi/4,10);
[Ab,Bb]=meshgrid(alphb,betab);
x=-(rE*cos(Bb)+e).*sin(Ab);
y=(rE*cos(Bb)+e).*cos(Ab);
z=rE*sin(Bb);
surf(X,Y,Z)
运行时总是提示Zmust be a matrix, not a scalar or vector.
查看workspace,z确实为10*11double型矩阵,请各位大侠帮忙修改~~
%syms alphb betab X Y Z; %这一行没有必要
rE=4226;
e=870;
alphb=linspace(-pi/6,pi/6,11);
betab=linspace(-pi/8,pi/4,10);
[Ab,Bb]=meshgrid(alphb,betab);
x=-(rE*cos(Bb)+e).*sin(Ab);
y=(rE*cos(Bb)+e).*cos(Ab);
z=rE*sin(Bb);
surf(x,y,z) %区分大小写的
rE=4226;
e=870;
alphb=linspace(-pi/6,pi/6,11);
betab=linspace(-pi/8,pi/4,10);
[Ab,Bb]=meshgrid(alphb,betab);
x=-(rE*cos(Bb)+e).*sin(Ab);
y=(rE*cos(Bb)+e).*cos(Ab);
z=rE*sin(Bb);
surf(x,y,z) %区分大小写的