在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2906|回复: 2

画7/8圆球,matlab

[复制链接]
发表于 2016-10-15 10:06:43 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
close  all;   clc;      clear all;
% % % % % % % % % % % % % % %   下半圆
t=linspace(pi/2,pi,100);
p=linspace(0,2*pi,100);
[theta,phi]=meshgrid(t,p);
x=sin(theta).*sin(phi);
y=sin(theta).*cos(phi);
z=cos(theta);
[m,n]=size(z);
re=[255/256 255/256 0/256];%改数字 改变颜色、数字为0-1
colormap(re)
surf(x,y,z);
% shading interp
shading flat
axis equal;
% % % % % % % % % % % % % % % 上四分之三圆
hold on
t=linspace(0,pi/2,100);
p=linspace(pi/2,2*pi,100);
[theta,phi]=meshgrid(t,p);
x=sin(theta).*sin(phi);
y=sin(theta).*cos(phi);
z=cos(theta);
[m,n]=size(z);
re=[255/256 255/256 0/256];%改数字 改变颜色、数字为0-1
colormap(re)
surf(x,y,z);
% shading interp
shading flat
axis equal;
% % % % % % % % % % % % % % % % 内圆环
R = 1; r = 0.5;
theta=linspace(0,pi/2,90);ph=linspace(r,R,30);
[t,p]=meshgrid(theta,ph);
r=t*0;
[x,y,z]=pol2cart(t,p,r);
surf(x,z,y,'edgecolor','none');
re=[255/256 255/256 0/256];
colormap(re)
R = 1; r = 0.5;
theta=linspace(0,pi/2,90);ph=linspace(r,R,30);
[t,p]=meshgrid(theta,ph);
r=t*0;
[x,y,z]=pol2cart(t,p,r);
surf(x,y,z,'edgecolor','none');
re=[255/256 255/256 0/256];
colormap(re)
R = 1; r = 0.5;
theta=linspace(0,pi/2,90);ph=linspace(r,R,30);
[t,p]=meshgrid(theta,ph);
r=t*0;
[x,y,z]=pol2cart(t,p,r);
surf(z,y,x,'edgecolor','none');
re=[255/256 255/256 0/256];
colormap(re)
% % % % % % % % % % % % % % % %

hold on
t=linspace(0,1/2*pi,1000);
x=1/2*cos(t);
y=zeros(1,1000);
z=1/2*sin(t);
fill3([0 x],[0 y],[0 z],[0/256 199/256 255/256],'edgecolor','none')
re=[255/256 255/256 0/256];
colormap(re)
x=1/2*cos(t);
y=1/2*sin(t);
z=zeros(1,1000);
fill3([0 x],[0 y],[0 z],[0/256 199/256 255/256],'edgecolor','none')
x=zeros(1,1000);
y=1/2*sin(t);
z=1/2*cos(t);
fill3([0 x],[0 y],[0 z],[0/256 199/256 255/256],'edgecolor','none')
axis off
% % % % % % % % % % % % % % % % % % % % % %
light
 楼主| 发表于 2016-10-15 10:07:24 | 显示全部楼层
发表于 2021-10-14 16:58:55 | 显示全部楼层
very good thanks  useful
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /3 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-24 14:57 , Processed in 0.024688 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表