central_diff.m

版本 2.0.0.0 (4.1 KB) 作者: Robert Canfield
Calculates numeric gradient using second-order difference formula for unevenly spaced data
10.4K 次下载
更新时间 2015/10/1

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

The central_diff function calculates a numeric gradient using second-order accurate difference formula for evenly or unevenly spaced coordinate data. It operates in a similar fashion to the MATLAB function, gradient, except that it permits only one independent variable, x, and correctly handles unevenly spaced values of the x-coordinate data. Accuracy is increased at the ends relative to the MATLAB gradient function, which uses only first-order forward or backward differences at the ends, by instead using second-order forward difference at the left end and second-order backward difference at the right end.

引用格式

Robert Canfield (2024). central_diff.m (https://www.mathworks.com/matlabcentral/fileexchange/12-central_diff-m), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2015b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Interpolation 的更多信息
标签 添加标签
致谢

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
2.0.0.0

Second-order accurate forward and backward difference formulae are used now at the left and right ends, instead of first-order forward/backward differences at the ends. Logical operators & and | were replaced with && and ||, respectively.

1.0.0.0