MATLAB: How to obtain a numeric value of an integral involving 3 variables and a bessel function

numerical integration

Hello,
I'm facing a problem in defining the following problem;
e=0:0.01:1;
a=17.6e-6;
lambda = 1.0084;
h=a;
E=@(S)sqrt(e).*lambda.*besselj(0,S.*a.*e);
E1=@(S)E./(1+exp(-2.*S.*h));
E2=@(S)exp(-2.*S.*h)./(1+exp(-2.*S.*h));
w1=@(S)(E1(S).*exp(-S.*y)+E2(S).*exp(S.*y)).*cos(S.*x);
w=integral(w1,0,inf)
The problems are;
1) In defining the function E (where the integration is on a variable "e" but "S" is also there ranging from 0 to inf).
2) In evaluating the numeric value of "w" when three variables i.e. x, y and S are involved.
For convenience, the snapshot of the equation is as follows;
Thanks for taking out time to help.

Best Answer

function main
a = 17.6e-6;
lambda = 1.0084;
h = a;
x = ...;
y = ...;
int_w_z = 2/pi*integral(@(s)w_z(s,lambda,a,h,x,y),0,Inf)
function val = w_z(s,lambda,a,h,x,y)
fun_E = @(e,lambda,s,a) sqrt(e).*lambda.*besselj(0,s*a*e);
for k=1:numel(s)
E = integral(@(e)fun_E(e,lambda,s(k),a),0,1);
E1 = E/(1+exp(-2*s(k)*h));
E2 = E*exp(-2*s(k)*h)/(1+exp(-2*s(k)*h));
val(k) = (E1*exp(-s(k)*y)+E2*exp(s(k)*y))*cos(s(k)*x);
end