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

matlab 两个球面三维图合并于同一坐标系

相关文章:

  • 2022-01-07
  • 2021-11-17
  • 2021-03-30
  • 2021-11-26
  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-31
  • 2021-12-02
  • 2021-10-19
  • 2021-07-07
  • 2022-12-23
相关资源
相似解决方案