I have been trying to figure out this integral for some time, but have come up short. I have tried doing a symbolic integration, but I get it shot back out at me, so I am assuming there is not solution that way. I have resolved to solve it with a definite integral, but still keep getting errors:
clear
clc
x = 1;
y = 1;
z = 1;
R = 2;
b =@(theta) y.*cos(theta)/((x-R.*cos(theta)).^2+y.^2+(z -
R.*sin(theta)).^2).^(3/2)
integral(b,1,2)
My current error is:
Error using integralCalc/finalInputChecks (line 515)
Output of the function must be the same size as the input. If FUN is an array-valued
integrand, set the 'ArrayValued' option to true.
Error in integralCalc/iterateScalarValued (line 315)
finalInputChecks(x,fx);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Any help would be very appreciated!
You need to change the division sign in the first term from /
to ./
to ensure that you are doing element-wise division and not matrix right division:
b = @(theta) y.*cos(theta)./((x-R.*cos(theta)).^2+y.^2+(z - ...
R.*sin(theta)).^2).^(3/2);
integral(b,1,2)
ans =
0.055781612354862