MATLAB: Error while executing integral function

integral

function A = bessel_coefficients(F,alpha)
A = zeros(size(alpha));
s = size(alpha);
N = s(2);
for ii = 1:N
a = 2/(besselj(1,alpha(ii)))^2;
b = @(r) besselj(0,alpha(ii)*r);
fun = @(r) F(r)*b*r;
A(ii) = a * integral(@(r) fun,0,1,"ArrayValued",true);
end
The error message I have recieved :
Operator '.*' is not supported for operands of type 'function_handle'
Error in integralCalc/iterateArrayValued (line 156)
fxj = FUN(t(1)).*w(1);
Error in integralCalc/vadapt (line 130)
[q,errbnd] = iterateArrayValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in bessel_coefficients (line 10)
A(i) = a * integral(@(r) fun,0,1,"ArrayValued",true);
I cant seem to figure out the solution to this issue. Any hints on what i can do?

Best Answer

Change the line
fun = @(r) F(r)*b*r;
to
fun = @(r) F(r)*b(r)*r;
and replace
A(ii) = a * integral(@(r) fun,0,1,"ArrayValued",true);
with
A(ii) = a * integral(fun,0,1,"ArrayValued",true);