Nested Numerical Integral in Matlab
Mostrar comentarios más antiguos
Hello, I am fairly new in using Matlab and was wondering if a nested numerical integral was possible. I have seen a number of other questions here where the outer variable of integration appears in the limits of the inner integral but the function being integrated over just depends on one variable. So I was wondering how or if it's possible to do, say:
z = integral( e^(-integral(f(x,y),x,0,1)),y,0,1)
Respuesta aceptada
Más respuestas (2)
Richard
el 18 de Jul. de 2017
Seems to me that this is what you are looking for. I assumed a random expression for f function since you did not specify it.
f =@(x,y) x+y;
integral(@(y) exp(-integral(@(x) f(x,y),0,y)),0,1,'ArrayValued',true)
Roger Stafford
el 12 de Dic. de 2012
Editada: Walter Roberson
el 7 de Feb. de 2025
0 votos
The functions 'dbsquad' and 'quad2d' are designed to numerically solve just your kind of problem. The former uses the the kind of fixed integration limits that you have described and the latter allows variable limits. Be sure to read their descriptions carefully so you can define the integrand function properly.
Roger Stafford
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!