"Conversion to logical from sym is not possible" arising in bisection method

1 visualización (últimos 30 días)
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Mayo de 2021
fgss = (gss - (gsms * m1 * (k1 - m1^2/2 *log((k1+k)/m1))/pi^2 )) ;
f = matlabFunction(fgss)

Más respuestas (0)

Categorías

Más información sobre Formula Manipulation and Simplification en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by