"Conversion to logical from sym is not possible" arising in bisection method
1 次查看(过去 30 天)
显示 更早的评论
The following is my code. i want to calculate gss here. problem arising in " if f(gss1)*f(gss2) < 0 ". In command window " Conversion to logical from sym is not possible. " this type of comment is showing. Want some help to do this. thanks in advance.
syms gss
m = 4.7542;
gsms = 11.299 ;
gomo = 5.696 ;
gpmp = 4.656 ;
m1 = (m - gss);
p = 0 ;
k = (3 * p * pi^2 / 2)^(1/3) ;
k1 = sqrt(k^2 + m1^2);
goo = gomo * p ;
moo = goo * p/2 ;
f(gss) = (gss - (gsms * m1 * (k1 - m1^2/2 *log((k1+k)/m1))/pi^2 )) ;
pretty(f);
gss1 = input('gss1=');
gss2 = input('gss2=');
if f(gss1)*f(gss2) < 0
gss = (gss1+gss2)/2 ;
n = 0;
while abs (f(gss))> 0.00001
n = n + 1;
gss = (gss1 + gss2)/2;
if f(gss1)*f(gss)< 0
gss2 = gss;
else
gss1 = gss;
end
end
fprint('no root')
end
0 个评论
采纳的回答
Walter Roberson
2021-5-17
fgss = (gss - (gsms * m1 * (k1 - m1^2/2 *log((k1+k)/m1))/pi^2 )) ;
f = matlabFunction(fgss)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numbers and Precision 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!