How do you estimate a rate at every measurement time?

gradient ordinarily uses centered differences in the interior and one-sided differences at the boundaries. Sample spacing sets the scale.

numpy.gradient in practice

Positions zero, four and eight sampled every two seconds give two units per second throughout. Supply the measured coordinates when spacing varies.

import numpy as np
np.gradient([0.,4.,8.],2)

Result [2.0, 2.0, 2.0]

中文

如何估计每个测量时刻的变化率?

gradient 在内部通常用中心差分,边缘用单侧差分,可接受坐标间距作为单位换算。

numpy.gradient 算例

每两秒记录位置 0、4、8,三个速度估计都是每秒 2。间隔不均匀时,传入真实测量坐标才能保留单位意义。

import numpy as np
np.gradient([0.,4.,8.],2)

结果 [2.0, 2.0, 2.0]

References / 参考来源

Keep reading / 继续阅读