弹簧上的迭代速度估计值

问题描述 投票:1回答:1

问题:

考虑如图below所示的带有质量和弹簧的系统。弹簧的刚度和物体的质量是已知的。因此,如果弹簧被拉伸,则可以从Hooke`s law计算弹簧施加的力,并且可以从牛顿运动定律估算瞬时加速度。对加速度进行两次积分,得出弹簧将移动的距离,并从初始长度中减去该距离会得出一个新的位置,以计算加速度并再次启动循环。因此,当加速度线性降低时,速度会稳定在某个值(top right)。此后,一切都将忽略,因此弹簧压缩和减速被忽略。

我的问题是如何在python中进行编码。到目前为止,我已经写了一些伪代码。

instantaneous_acceleration = lambda x: 5*x/10    # a = kx/m
delta_time = 0.01     #10 milliseconds
a[0] = instantaneous_acceleration(12)     #initial acceleration when stretched to 12 m
v[0] = 0        #initial velocity 0 m/s
s[0] = 12       #initial length 12 m
i = 1
while a[i] > 12:
    v[i] = a[i-1]*delta_time + v[i-1]      #calculate the next velocity
    s[i] = v[i]*delta_time + s[i-1]        #calculate the next position
    a[i] = instantaneous_acceleration (s[i])          #use the position to derive the new accleration
    i = i + 1

非常感谢任何帮助或提示。

问题:考虑一个带有质量和弹簧的系统,如下图所示。弹簧的刚度和物体的质量是已知的。因此,如果弹簧被拉伸,则...

python spring loops math physics
1个回答
0
投票

如果您要预先集成-这是一个好主意,并且绝对是您可能要走的路-那么您只需将等式写成t的函数,即可将所有内容写下来:

© www.soinside.com 2019 - 2024. All rights reserved.