一阶导数的3种近似:前向差分,后向差分,中心差分

分类: computerVision |
这里有zhihu上根据taylor展开来证明:
根据taylor展开得到一阶导数的计算公式,如果都只截取到第2项,那么中心求导的精度为平方(dx),这是因为一次项被抵消了。
forward difference 误差:
If the data values are equally spaced with the step size h,
the truncation error of the forward difference approximation has
the order of O(h)
backward difference误差:
If the data values are equally spaced with the step size h,
the truncation error of the backward difference approximation has
the order of O(h)
central difference误差:
If the data values are equally spaced, the central difference is an average of the forward and backward differences. The truncation error of the central difference approximation is order of O(h2),
where h is
the step size
If the data values are equally spaced with the step size
backward difference误差:
If the data values are equally spaced with the step size
central difference误差:
If the data values are equally spaced, the central difference is an average of the forward and backward differences. The truncation error of the central difference approximation is order of
结论就是从误差的角度来看,forward,backward是一样的,但是central最好,因此结论就是“尽量使用central”It is best to use central differences
whenever possible
二阶导数: