Numerically Solve for Upperbound on numerical Integral

14 ビュー (過去 30 日間)
dsmalenb
dsmalenb 2019 年 2 月 12 日
コメント済み: Star Strider 2019 年 2 月 12 日
Hi all,
I am trying to determine how to write the solver code for this example problem. I want to determine the quantitiy s for a given value v such that the following holds true. Although I have provided an explicit integrand here, I am looking for the general code to evaluate this properly with any specified integrand. I just used this one because I am not looking for an analytical solution to this example.
v = 1; % Just an example value
syms s
fun = @(x) x.^x;
vpasolve(integral(fun,x,0,s)==v,s)
The error I get is as follows:
Undefined function or variable 'x'.
vpasolve(integral(fun,x, 0,s)==v,s)
I am sure I am missing something silly. I would appreciate any help you can provide.

採用された回答

Star Strider
Star Strider 2019 年 2 月 12 日
Try this:
v = 1; % Just an example value
fun = @(x) x.^x;
sval = fzero(@(s)integral(fun,0,s)-v, 1)
Check = integral(fun,0,sval) % Delete Later
produces:
sval =
1.19490700802612
  2 件のコメント
dsmalenb
dsmalenb 2019 年 2 月 12 日
Excellent. Thank you.
Star Strider
Star Strider 2019 年 2 月 12 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 2 月 12 日
syms x
vpasolve(int(fun(x), x, 0, s) == v, s)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by