"Conversion to logical from sym is not possible" arising in bisection method
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pritha
am 17 Mai 2021
Beantwortet: Walter Roberson
am 17 Mai 2021
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 17 Mai 2021
fgss = (gss - (gsms * m1 * (k1 - m1^2/2 *log((k1+k)/m1))/pi^2 )) ;
f = matlabFunction(fgss)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!