📜  简单摆 - 定义、公式、推导、示例(1)

📅  最后修改于: 2023-12-03 15:11:32.461000             🧑  作者: Mango

简单摆 - 定义、公式、推导、示例

定义

简单摆是由一根固定在底部的轻质、无摩擦细线,挂着一个质量为m、长度为l的质点所组成的摆。

公式

简单摆的运动方程可以表示为:

Simple pendulum formula

其中:

  • θ(t)是摆的偏转角度,t是时间。
  • g是重力加速度。
  • l是摆长。
推导

我们可以通过受力分析推导出上述公式。

假设在t时刻,摆的偏移角度是θ(t)。其受到以下两个力的作用:

  • 重力:Fg = -mgj
  • 力矩:T = -mglsin(θ)

其中,j是重力方向的单位向量。

由牛顿第二定律得到关于θ的二阶微分方程:

Simple pendulum force derivation

示例

我们可以使用Python模拟简单摆的运动。下面是一个代码示例:

import numpy as np
import matplotlib.pyplot as plt

g = 9.8  # 重力加速度
l = 1.0  # 摆长
theta0 = np.pi / 3.0  # 初始偏转角度
omega0 = 0.0  # 初始角速度
dt = 0.01  # 时间步长
t = np.arange(0.0, 10.0, dt)  # 时间向量

theta = np.zeros_like(t)
omega = np.zeros_like(t)

theta[0] = theta0
omega[0] = omega0

for i in range(1, len(t)):
    theta[i] = theta[i-1] + omega[i-1]*dt
    omega[i] = omega[i-1] - (g/l)*np.sin(theta[i-1])*dt

plt.plot(t, theta)
plt.xlabel('Time (s)')
plt.ylabel('Theta (radians)')
plt.title('Simple Pendulum')
plt.show()

以下是程序输出的结果:

Simple pendulum simulation results