I can't run this function -nonlinear equation system
2 ビュー (過去 30 日間)
古いコメントを表示
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
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
2022 年 3 月 31 日
fun = @root;
% Your function is not defined at [0,0]
root([0 0])
% Try a different initial points
x0 = [0.1,0.1];
x = fsolve(fun, x0)
% 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
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!