derivative

バージョン 1.0.0.0 (1.41 KB) 作成者: David Powers
Efficient approximation of first, second and third derivatives of a function.
ダウンロード: 753
更新 2016/1/5

ライセンスの表示

[ first, second, third, ymat ] = derivative ( fn, x )

Quickndirty estimate of first, second and third derivatives of a function at a specified point or vector of points.
Input should be n x 1 vector of points (centres) to evaluate at (for any number of points n).
first, second, third and fourth derivatives will follow suit as n x 1 vector outputs.
ymat output is a n x 7 matrix of samples zigzagging around centres (optional).

Internal delta specifies the precision multiplying zigzag offsets:
[0 -0.5 +0.5 -1.0 +1.0 -1.5 +1.5]

For efficiency samples are calculated once + multiple symmetric derivatives.
For the same reason the local sampling matrix ymat is made available.
Reducing the precision (delta) below that given is dangerous/unstable.

Examples:
x = [-5:.1:5]';
[first, second, third, value] = derivative(@sin,x);
figure(1); plot(x,[first, second, third, value(:,1)]);grid
[first, second, third, value] = derivative(@normpdf,x);
figure(2); plot(x,[first, second, third, value(:,1)]);grid

David M W Powers Jan 2016

引用

David Powers (2024). derivative (https://www.mathworks.com/matlabcentral/fileexchange/54707-derivative), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R10
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0

added of gaussian and first three derivatives