Azzera filtri
Azzera filtri

Solving a nonlinear equation using fsolve. cant reach at perfect result. output showing some error written below.

1 visualizzazione (ultimi 30 giorni)
Where M*_N = m - (a*sigma)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the
function tolerance, and the problem appears regular as measured by the gradient.
used code :
Result must be around 22-25. but itc coming .0029.
Is there anything wrong i am doing?
  1 Commento
Star Strider
Star Strider il 23 Gen 2022
Since fsolve is a root-finding algorithm, plot the function to see if there are any zero-crossings. Since fsolve can find complex as well as real roots, it might be worth giving it complex initial parameter estimates to see what it finds.

Accedi per commentare.

Risposta accettata

Matt J
Matt J il 23 Gen 2022
Modificato: Matt J il 23 Gen 2022
Result must be around 22-25. but itc coming .0029.
As the plot shows, your function has no roots in the range 22-25
p = 1;
pfun=@(sigma) arrayfun( @(z)fun(z,p) , sigma);
fplot(pfun,[0,25])
xlabel sigma; ylabel fun
function sigmares = fun(sigma,p)
m = 939;
ms = 550;
b = -7.25*10^(-3);
gs = 8.238;
p0 = .15*(197.3)^3;
k = (1.5*p*p0*pi^2)^(1/3);
gss = (1 + (b*sigma/2))*gs;
m1 = (m-(gss*sigma));
F = ((1+(b*sigma))*gs*m1*(1/(2*ms^2*pi^3))*log((sqrt(k^2 + m1^2)+ k))) - sigma;
sigmares = F ;
end
  6 Commenti

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by