求助用MATLAB画一个被截的球体
答案:2 悬赏:0 手机版
解决时间 2021-03-19 23:25
- 提问者网友:自食苦果
- 2021-03-19 18:26
求助用MATLAB画一个被截的球体
最佳答案
- 五星知识达人网友:躲不过心动
- 2021-03-19 19:46
[X, Y, Z] = sphere(60);
t = ~((X.^2+Y.^2>0.5) & Z<0.5 & Z>-0.5);
X(t) = nan;
Y(t) = nan;
Z(t) = nan;
surf(X, Y, Z)
axis tight
axis equal
t = ~((X.^2+Y.^2>0.5) & Z<0.5 & Z>-0.5);
X(t) = nan;
Y(t) = nan;
Z(t) = nan;
surf(X, Y, Z)
axis tight
axis equal
全部回答
- 1楼网友:渊鱼
- 2021-03-19 20:54
代码如下:
clc
clear
[x1,y1,z1] = ellipsoid(0,0,0,1,1,1);
[x2,y2,z2] = meshgrid(-1:0.01:1,-1:0.01:1,0.5);
[x3,y3,z3] = meshgrid(-1:0.01:1,-1:0.01:1,-0.5);
figure(1)
hold on
view(-37.5,15);
surf(x1,y1,z1);
surf(x2,y2,z2);
surf(x3,y3,z3);
axis equal
grid on
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯