フィルターのクリア

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 件のコメント
Walter Roberson
Walter Roberson 2022 年 1 月 24 日
It is the only real root. There might be several complex roots

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver 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