フィルターのクリア

I can't run this function -nonlinear equation system

2 ビュー (過去 30 日間)
Lucia Pellicer
Lucia Pellicer 2022 年 3 月 31 日
コメント済み: Alex Sha 2022 年 3 月 31 日
Hello!
My code is:
function F = root(x)
F(1) = ((1/((1/(32/(x(1)*60)))+(1/(1/((5.67E-08*60*(x(1)^2+353^2)*(x(1)+353))/(1/0.035+(60/57.7*(1/0.035-1))))))))*(x(1)-20) - (8/(0.082*57.7))*(353-x(1)));
F(2) = ((1/((1/(32/(x(2)*60)))+(1/(1/((5.67E-08*60*(x(1)^2+353^2)*(x(1)+353))/(1/0.035+(60/57.7*(1/0.035-1)))))))) + (8/(0.082*57.7)))*(353-x(1)) - ((1/((1/(32/(x(2)*57.7))))+(1/(1/((5.67E-08*57.7*(x(1)^2+353^2)*(x(1)+353))/(1/0.035+(60/57.7*(1/0.035-1))))))))*(x(1)-20);
end
I am trying to solve this equation and it gives me the following error:
fun = @root;
x0 = [0,0];
x = fsolve(fun,x0)
Error using fsolve
Objective function is returning undefined values at initial point. FSOLVE cannot continue.
  1 件のコメント
Alex Sha
Alex Sha 2022 年 3 月 31 日
There are multi-solutions:
No. x1 x2
1 352.707085204498 -0.0552273002006459
2 -1.40777299574092 -1.68141237126893
3 352.707085204514 -5.57004739748473

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

回答 (1 件)

Chunru
Chunru 2022 年 3 月 31 日
fun = @root;
% Your function is not defined at [0,0]
root([0 0])
ans = 1×2
-604.5139 Inf
% Try a different initial points
x0 = [0.1,0.1];
x = fsolve(fun, x0)
Solver stopped prematurely. fsolve stopped because it exceeded the function evaluation limit, options.MaxFunctionEvaluations = 2.000000e+02.
x = 1×2
1.0e+06 * 0.0001 -2.8223
% Suggest to check the function definition to see if the problem is well
% defined
function F = root(x)
F(1) = ((1/((1/(32/(x(1)*60)))+(1/(1/((5.67E-08*60*(x(1)^2+353^2)*(x(1)+353))/(1/0.035+(60/57.7*(1/0.035-1))))))))*(x(1)-20) - (8/(0.082*57.7))*(353-x(1)));
F(2) = ((1/((1/(32/(x(2)*60)))+(1/(1/((5.67E-08*60*(x(1)^2+353^2)*(x(1)+353))/(1/0.035+(60/57.7*(1/0.035-1)))))))) + (8/(0.082*57.7)))*(353-x(1)) - ((1/((1/(32/(x(2)*57.7))))+(1/(1/((5.67E-08*57.7*(x(1)^2+353^2)*(x(1)+353))/(1/0.035+(60/57.7*(1/0.035-1))))))))*(x(1)-20);
end

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by