MATLAB: Triple Numerical Integration with function boundaries

functional bordernumerical integrationquad2dquad3d

Hello,
I am having an issue quite similar to another question that has been previously addressed:
However, what I need differs slightly.
Say instead of phi, we have phi_1 and phi_2, and say that in the integral from the original question, x ranges between h_2(phi_1,phi_2) and h_1(phi_1,phi_2), and then replace the single integration with respect to phi with a double integral over phi_1 and phi_2 where the ranges over phi_1 and phi_2 are expressed by scalars, how would we compute such messy triple integral?
Any guidance would be much appreciated.

Best Answer

Here is a sketch of the approach:
First, define your function to be integrated, e.g.,
f0 = @(x,phi1,phi2) 1./(h1(phi1,phi2)-h2(phi1,phi2))./(b-(xi-x).^2).^1.5;
(xi, h1, h2 to be specified by you). Define the inner integral:
f1 = @(phi1,phi2) quadl(f0,h1(phi1,phi2),h2(phi1,phi2));
And then integrate over the other two variables:
f2 = dblquad(f1,phi1_lb,phi1_ub,phi2_lb,phi2_ub);