我该如何编码?强制阻尼摆:d²θ/dt² + γ dθ/dt + ω₀²sin(θ) = -2A cos(ωt) sin(θ)
- 始终取 ω0 = π、θ0 = π/6 和 v0 = dθ₀/dt = 0。
- 假设 γ = 0.5 和 A = 1。求解至少五个 ω ∈ [1, 4.5] 值的运动方程。将 θ 绘制为时间的函数,并且 v= dθ/dt 与 θ
- 现在取 ω = 2.0 和 A = 1。求解至少十个 γ ∈ [0, 10] 值的运动方程。将 θ 绘制为时间的函数,并且 v= dθ/dt 与 θ
我刚刚写了这个:
from scipy.integrate import solve_ivp
import numpy as np
import matplotlib.pyplot as plt
w = np.linspace(1.,4.5,5)
w0 = np.pi
gama = 0.5
#Initial Conditions
θ_start = np.pi/6
v_start = 0.0
A = 1.
#Set loop variables
θ_position = θ_start
velocity = v_start
#Step Size
dt = 0.001
#Arrays to store variable values
θ_plot = []
v_plot = []
time = []
# the time interval 1 to 10 seconds in steps of 0.1
for t in np.arange(1,10,0.1):
what should I do now ?????????????????????
θ_plot.append(θ_position)
v_plot.append(velocity)
time.append(t)
plt.plot(time,θ_plot)