相关文章推荐
被表白的橙子  ·  使用Python ...·  9 月前    · 
愉快的单车  ·  ReactiveAuthentication ...·  1 年前    · 
机灵的小熊猫  ·  异常详细信息: ...·  2 年前    · 
有情有义的匕首  ·  spring data jpa ...·  2 年前    · 
沉稳的脆皮肠  ·  VB6.0 ...·  3 年前    · 
原题如下:已知曲面方程z=sqrt(2x^2+3y^2),1<=x^2+y^2<=9,请编写程序绘制曲面。... 原题如下:
已知曲面方程z=sqrt(2x^2+3y^2),1<=x^2+y^2<=9,请编写程序绘制曲面。 surf(X,Y,Z)中,X和Y是方阵,Z是列阵,理解了这个就不难了
function [ ] = surfcircle( )
r=0:0.05:1;theta=0:2*pi/52:2*pi;
nr=length(r);ntheta=length(theta);
X=zeros(nr,ntheta);Y=zeros(nr,ntheta);
nnr=1;
while nnr<=nr
nntheta=1;
while nntheta<ntheta+1
X(nnr,nntheta)=r(nnr)*cos(theta(nntheta));
Y(nnr,nntheta)=r(nnr)*sin(theta(nntheta));
nntheta=nntheta+1;
end
nnr=nnr+1;
end
Z=X*0+Y*0+1;
surf(X,Y,Z);
daspect([1 1 1])
end