我是靠谱客的博主 醉熏鞋垫,这篇文章主要介绍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}$

最后

以上就是醉熏鞋垫最近收集整理的关于matlab中如何画空心圆环,如何在MATLAB或Python中使用椭圆放样来创建三维空心管道?...的全部内容,更多相关matlab中如何画空心圆环,如何在MATLAB或Python中使用椭圆放样来创建三维空心管道?内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(151)

评论列表共有 0 条评论

立即
投稿
返回
顶部