clc;clear
R1=3; %球半径
n1=30; %网格大小=[n/2+2,n+1];
theta1 = (-n1:2:n1)/n1*pi;
phi1 = ([0,0:2:n1])'/n1*pi/2;
cosphi1 = cos(phi1);
cosphi1(1) = 0;
cosphi1(end) = 0;
sintheta1 = sin(theta1);
sintheta1(1) = 0;
sintheta1(end) = 0;
x1 = R1*cosphi1*cos(theta1);
y1 = R1*cosphi1*sintheta1;
z1= R1*sin(phi1)*ones(1,n1+1);
%mesh(x1,y1,z1);
mesh(x1,y1,z1,'FaceAlpha', 0)
axis equal
hold on
R=0.5; %球半径
n=30; %网格大小=[n/2+2,n+1];
theta = (-n:2:n)/n*pi;
phi = ([0,0:2:n])'/n*pi/2;
cosphi = cos(phi);
cosphi(1) = 0;
cosphi(end) = 0;
sintheta = sin(theta);
sintheta(1) = 0;
sintheta(end) = 0;
x = R*cosphi*cos(theta);
y = R*cosphi*sintheta;
z = R*sin(phi)*ones(1,n+1);
mesh(x,y,z);
%surf(x,y,z,'FaceAlpha', 1)
axis equal