how to set up a function involving integrals integral bounds

3 ビュー (過去 30 日間)
Maggie liu
Maggie liu 2021 年 7 月 29 日
コメント済み: Maggie liu 2021 年 8 月 2 日
I'm trying to set up a function that looks like where a is a constant.
how can I do this? when I try using the following code, it tells me that "Limits of integration must be double or single scalars."
Many thanks!
syms f(x)
f(x) = integral(fun,a,x);

採用された回答

Steven Lord
Steven Lord 2021 年 7 月 29 日
The integral function is for numeric integration.
The int function is for symbolic integration.
  2 件のコメント
Maggie liu
Maggie liu 2021 年 7 月 30 日
I'm still a bit confused...I looked up the documentation on int function, and just to test it out I tried the following sample code
syms x
f = cos(x)/sqrt(1 + x^2);
Fint = int(f,x,[0 10])
and got the this error message
Error using symfun/subsref (line 189)
Invalid argument at position 2. Symbolic function expected 1 input arguments but received 3.
Thanks for your help!
Maggie liu
Maggie liu 2021 年 8 月 2 日
I re-installed the symbolic math add on and it worked

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by