Problem with symbolic integration
Mostrar comentarios más antiguos
Hello there!
I do have a problem with symbolic integration. I'm calculating a volume,but I can't even get a result. The original code looks like this:
function f = fmbloss(phi)
n1 = 1.49;
n2 = 1.485;
ns1 = n1*n1;
ns2 = n2*n2;
lambda = 0.58e-6;
ra1 = 980e-6;
kw = 2*pi/lambda;
rad = 5e-3;
r0 = rad;
syms theta r
theta1 = acos(r0*cos(theta)/(rad+ra1));
theta2 = acos((rad+ra1)*cos(theta1)/(rad-ra1));
phip = 2*(theta1-theta2);
invarl = n1*cos(theta1);
invarls = invarl.*invarl;
p = invarl/n2;
ps = p.*p;
ln1 = sqrt(ns1-invarls);
ln2 = sqrt(invarls-ns2);
btf = 4*ln1.*ln2/(ns1-ns2);
bt = btf.*exp(-2*kw*ra1*invarl.*(log(p+sqrt(ps-1))-sqrt(ps-1)./p));
gamma = bt./phip
thetac = acos(n2/n1);
f1 = exp(-gamma*phi);
int1 = int(f1,theta,-thetac,thetac);
int2 = int(int1,r,rad-ra1,rad+ra1);
f = eval(int2);
and input fplot(@fmbloss,[0,pi/2]),grid on in the command window,
but
Warning: Explicit integral could not be found.
Warning: Explicit integral could not be found.
Undefined function 'isfinite' for input arguments of type 'sym'.
Error in fplot (line 113)
J = find(isfinite(y));
It is not working at all.I hope someone can give me a good advise, how to deal with that. Thank you!
4 comentarios
Walter Roberson
el 15 de Dic. de 2012
Please show enough code to reproduce the problem.
ZhiH
el 15 de Dic. de 2012
Walter Roberson
el 15 de Dic. de 2012
Okay, please put a breakpoint in at the int, and show me the values of thetac and f1
Also: you should not eval() a symbolic formula. If you are expecting a definite numeric value from it, use double(int2)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Calculus en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!