Problem with symbolic integration
古いコメントを表示
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 件のコメント
Walter Roberson
2012 年 12 月 15 日
Please show enough code to reproduce the problem.
ZhiH
2012 年 12 月 15 日
Walter Roberson
2012 年 12 月 15 日
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)
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!