Error using integral function
Ältere Kommentare anzeigen
Dear MATLAB users,
I am using integral function in which I am getting error. I read the questions others asked. The answers says we should add .* instead of * where two terms are getting multiplied. Kindly help to solve it as the function I am solving in "integral function" is autogenerated by some other function.
My code is as follows:
syms x y
alpha = 45*pi/180;
b = cos(alpha);
l = 0;
N = 10;
phi = 0;
X = (sqrt(1-x*x)/sin(alpha))*cos(phi);
Y = (sqrt(1-x*x)/sin(alpha))*sin(phi);
Z = (x-cos(alpha))/sin(alpha);
r = sqrt(X*X+Y*Y+Z*Z);
y1 = x;
y2 = (x/2)*log((1+x)/(1-x)) - 1;
for i=1:N
for j=1:N
fun = y1.*int(subs(y2.*r^j,x,y).*ALP(j,l,y),y,x,1)
G0j = integral(@(x)fun,b,1)
end
end
function y = ALP(j,l,x)
y = ((-1)^l)*(1-x*x)^(l/2)*diff(legendreP(j,x),l);
end
Error is as follows:
Error using integralCalc/finalInputChecks (line 522)
Input function must return 'double' or 'single' values. Found 'sym'.
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);
Error in rough (line 66)
G0j = integral(@(x)fun,b,1)
One more question:
I was initially using symbolic integration. But as I increase number of terms in expansion MATLAB didn't solve it but return expression as int(fun,Xmin,Xmax). Is there any way to resolve this. Can matlab solve complecated symbolic algebra?
Thank You.
Yashika
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Calculus finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!