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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical 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