How to add integral in a integral function

2 ビュー (過去 30 日間)
Haozhe Zhang
Haozhe Zhang 2022 年 11 月 30 日
コメント済み: Haozhe Zhang 2022 年 12 月 1 日
I need to add an complex integral inside of a integral function like this:
integral(@(x)sin(integral(@(a)sin(a),0,x)),0,1)
However, it turns out to be an error with message: “Limits of integration must be double or single scalars.”
P.S. My function is much complex than 'sin(x)', here just is an example.
How to solve this?

採用された回答

Torsten
Torsten 2022 年 11 月 30 日
編集済み: Torsten 2022 年 11 月 30 日
format long
integral(@(x)sin(integral(@(a)sin(a),0,x)),0,1,'ArrayValued',true)
ans =
0.156096097878724
integral(@(x)sin(1-cos(x)),0,1)
ans =
0.156096097878724
  1 件のコメント
Haozhe Zhang
Haozhe Zhang 2022 年 12 月 1 日
Thank you, that works.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by