N-Point Central Differencing

Computes an n-point central difference of function f with spacing h.

您现在正在关注此提交

Computes an n-point central difference of function f with spacing h.

Returns a vector df of same size as f.
Input f must be a vector with evenly spaced points.
Input n must be 3,5,7, or 9.

Differences for points near the edges are calculated with lower order.
For example, if n=5 and length(f)=10, then 3-point central differencing is used to calculate values at points 2 and 9, 2-point forward differencing is used for point 1, 2-point backward differencing is used for point 10, and 5-point central differencing is used for points 3-7.

Differencing formulae from: http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/central-differences/ Accessed 4/10/12.

引用格式

James (2026). N-Point Central Differencing (https://ww2.mathworks.cn/matlabcentral/fileexchange/36123-n-point-central-differencing), MATLAB Central File Exchange. 检索时间: .

致谢

启发作品: central_diff2(y,deltat,d,a)

类别

Help CenterMATLAB Answers 中查找有关 Shifting and Sorting Matrices 的更多信息

一般信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux
版本 已发布 发行说明 Action
1.2.0.0

Added automatic downgrading of n if length(f) < n.

1.1.0.0

Updated handling of erroneous inputs.

1.0.0.0