Nested Numerical Integral in Matlab
Mostra commenti meno recenti
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)
Risposta accettata
Più risposte (2)
Richard
il 18 Lug 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
il 12 Dic 2012
Modificato: Walter Roberson
il 7 Feb 2025
0 voti
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
Categorie
Scopri di più su Programming in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!