展开全部
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
theta = np.linspace(0, 2* np.pi, 100)
r, R = 9, 10 # 小圆2113和大圆的半径5261
# outter circle
X = R * np.cos(theta)
Y = R * np.sin(theta)
# innner circle
x = r * np.cos(theta)
y = r * np.sin(theta)
# pentagon vertices
p_theta = [np.pi/2 + np.pi*4/5 * i for i in range(6)] # 五角4102星的定点1653.
px = r * np.cos(p_theta)
py = r * np.sin(p_theta)
# plot
plt.plot(X, Y, label=’Big Circle’, color=’blue’)
plt.plot(x, y, label=’Small Circle’, color=’green’)
plt.plot(px, py, label=’Pentagon’, color=’red’)
plt.axis(‘equal’)
plt.legend(loc=’upper left’)