How to add integral in a integral function

2 visualizaciones (últimos 30 días)
Haozhe Zhang
Haozhe Zhang el 30 de Nov. de 2022
Comentada: Haozhe Zhang el 1 de Dic. de 2022
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?

Respuesta aceptada

Torsten
Torsten el 30 de Nov. de 2022
Editada: Torsten el 30 de Nov. de 2022
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

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by