Error while executing integral function
3 views (last 30 days)
Show older comments
Mahmoud Abdalhamid
on 8 Apr 2020
Commented: Ameer Hamza
on 8 Apr 2020
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?
2 Comments
Accepted Answer
Ameer Hamza
on 8 Apr 2020
Edited: Ameer Hamza
on 8 Apr 2020
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);
7 Comments
More Answers (0)
See Also
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!