Derivative after Numerical Integral

3 ビュー (過去 30 日間)
Esra Akdogan
Esra Akdogan 2019 年 5 月 27 日
編集済み: Star Strider 2019 年 5 月 27 日
hello everyone,
I have a function of x, however I get it after calculating a numerical integral, such as:
a = @(x) (integral(@(x1) sqrt((x+4).*(x1+2)./(x1+1)),0,1))
I need to take the derivative of a in terms of x, and then I calculate the values of diff(a) for different x values.
Any help will be appreciated.

採用された回答

Star Strider
Star Strider 2019 年 5 月 27 日
編集済み: Star Strider 2019 年 5 月 27 日
Try this:
dfdx = @(f,x) (f(x + 1E-8) - f(x)) ./ 1E-8; % Simple Numeric Derivative
a = @(x) (integral(@(x1) sqrt((x+4).*(x1+2)./(x1+1)),0,1, 'ArrayValued',1))
x = linspace(-1, 1, 25);
dadx = dfdx(a,x);
figure
plot(x, dadx)
grid
Make appropriate changes to ‘x’ for your needs.
EDIT —
You can also use the gradient (link) function to calculate the derivative of a (regularly-spaced) vector of values proeuced by your ‘a’ function.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by