MATLAB Answers

Error while integrating bessel functions

9 views (last 30 days)
Hi,
I am trying to solve the integral equation with Bessel functions as shown in the attached image.
I get a error "Operator '+' is not supported for operands of type 'function_handle'".
Can anyone specify how to rectify the error.
The code is as follows,
gammalv = 72e-3;
gammasv = 0.06;
h = 50e-6;
nu = 0.5;
E = 3000;
R = 0.2e-3;
r = 0.0002;
a = @(s) (5 - 12*nu + 8*nu.^2 + 2*s.^2*h.^2 + (3 - 4*nu)*cosh(2*s.*h))./((3 - 4*nu)*sinh(2*s.*h) - 2*s.*h);
b = @(s) (2*(1 - nu.^2).*s.*gammasv)./E;
Q = @(s) 2*(1 - (nu.^2))./(s.*E).*(1./(a + b));
f = @(s) s.*(R.*besselj(0,s.*R) - ((2*besselj(1,s.*R))./s)).*Q(s).*besselj(0,s.*r);
ans = integral(f,0,inf);
Thanks,
Alwar

Accepted Answer

Star Strider
Star Strider on 14 Sep 2021
The problem is:
Q = @(s) 2*(1 - (nu.^2))./(s.*E).*(1./(a(s) + b(s)));
↑ ← HERE
These both need to be evaluated with their arguments (that I supplied here).
gammalv = 72e-3;
gammasv = 0.06;
h = 50e-6;
nu = 0.5;
E = 3000;
R = 0.2e-3;
r = 0.0002;
a = @(s) (5 - 12*nu + 8*nu.^2 + 2*s.^2*h.^2 + (3 - 4*nu)*cosh(2*s.*h))./((3 - 4*nu)*sinh(2*s.*h) - 2*s.*h);
b = @(s) (2*(1 - nu.^2).*s.*gammasv)./E;
Q = @(s) 2*(1 - (nu.^2))./(s.*E).*(1./(a(s) + b(s)));
f = @(s) s.*(R.*besselj(0,s.*R) - ((2*besselj(1,s.*R))./s)).*Q(s).*besselj(0,s.*r);
ans = integral(f,0,inf);
Warning: Inf or NaN value encountered.
There are still problems with infinite results. The second term of ‘f’ (with ‘s’ in the numerator and denominator) is likely the cause. I leave that for you to resolve.
.
  2 Comments
Star Strider
Star Strider on 14 Sep 2021
My pleasure!
The result returned is NaN not Inf since the result will be of the 0/0 calculation, while an Inf result would be the result of a x/0 calculation with ‘x’ being any non-zero value.
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by