matlab中如何画空心圆环,如何在MATLAB或Python中使用椭圆放样来创建三维空心管道?...

对于那些对以上答案的Python实现感兴趣的人:import numpy as np

from mpl_toolkits.mplot3d import Axes3D

import matplotlib.pyplot as plt

from scipy.interpolate import CubicSpline

from matplotlib import cm

#Create the profile

Radii = [1, 1.5, 1, 0.8, 1.3, 0.6, 0.5]

Zradii = [0, 1, 5, 10, 12, 14, 16]

radius = CubicSpline(Zradii, Radii, bc_type=((1, 0.5), (1, 0.0)))

# Make data

thetarange = np.linspace(0, 2 * np.pi, 100)

zrange = np.linspace(min(Zradii), max(Zradii),100)

X = [radius(z)*np.cos(thetarange) for z in zrange]

Y = [radius(z)*np.sin(thetarange) for z in zrange]

Z = np.array([[z] for z in zrange])

# Plot the surface

fig = plt.figure()

ax = fig.add_subplot(111, projection='3d')

ax.set_xlim3d(-2, 2)

ax.set_ylim3d(-2, 2)

ax.set_zlim3d(0, 20)

ax.plot_surface(X, Y, Z, cmap=cm.coolwarm)

#Plot the circles

for zz in Zradii:

XX = radius(zz)*np.cos(thetarange)

YY = radius(zz)*np.sin(thetarange)

ax.plot(XX,YY,zz, lw=1, color='k')

plt.show();

对于椭圆:

^{pr2}$

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值