필터 지우기
필터 지우기

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 CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by