import matplotlib.pyplot as plt

# 定义计算乒乓球弹起高度的函数
def calculate_bounce_height(diameter, release_height):
    return release_height * (diameter / 10) ** 0.5

# 定义直径和释放高度
diameters = [10, 15, 20, 25]
heights = [50, 100, 150, 200]

# 绘制曲线图
plt.figure(figsize=(10, 6))
for diameter in diameters:
    bounce_heights = [calculate_bounce_height(diameter, height) for height in heights]
    plt.plot(heights, bounce_heights, label=f'Diameter {diameter} cm')

plt.xlabel('Release Height (cm)')
plt.ylabel('Bounce Height of Ping Pong Ball (cm)')
plt.title('Ping Pong Ball Bounce Height vs. Release Height for Different Container Diameters')
plt.legend()
plt.grid()
plt.show()