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

1 次查看(过去 30 天)
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 个评论
Star Strider
Star Strider 2022-1-23
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.

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2022-1-23
编辑:Matt J 2022-1-23
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by