MATLAB: How to calculate 5 times integral

integration

Dear all, I have a problem with a big integral which contains other 4 integrals inside. I have no idea how to do it. Could you please help. Thanks
F0=@(S0) integral2(@(r,z) r.*besselj(1,S0.*r).*exp(-S0.*abs(-z)), a1, a2, b1, b2);
F_L=@(x0,r0,z0) r0.*besselj(1,x0.*r0).*exp(x0.*z0).*F0(x0);
L_lossy=integral3(F_L,0,Inf, c1, c2, d1, d2,'RelTol',1e-6,'AbsTol',1e-12)
where a1, a2, …, d2 are numerical values.
P/S I have attached the equation in the a.png file

Best Answer

Try
function main
a1 = ...;
a2 = ...;
b1 = ...;
b2 = ...;
c1 = ...;
c2 = ...;
d1 = ...;
d2 = ...;
value = integral(@(x)fun(x,a1,a2,b1,b2,c1,c2,d1,d2),0,Inf);
function d = fun(x,a1,a2,b1,b2,c1,c2,d1,d2)
fun1=@(a,y) y.*besselj(1,a*y);
fun2=@(a,y) exp(a*y);
fun3=@(a,y) exp(-a*abs(-y));
for i=1:numel(x)
xactual = x(i);
factor1 = integral(@(y)fun1(xactual,y),a2,a1);
factor2 = integral(@(y)fun1(xactual,y),c2,c1);
factor3 = integral(@(y)fun2(xactual,y),b2,b1);
factor4 = integral(@(y)fun3(xactual,y),d2,d1);
d(i)=factor1*factor2*factor3*factor4;
end
Best wishes
Torsten.