How to fix error in fsolve
조회 수: 8 (최근 30일)
이전 댓글 표시
I want to solve following function
function F = root2d(x)
F(1) = X(1) - exp(13.5-(2700/(x(3)-55)));
F(2) = x(2) - exp(14-(3050/(x(3)-57)));
F(3) = 0.4*x(1) - 140*x(2);
F(4) = 0.6*x(2) - 140*x(5);
F(5) = x(4) + x(5)-1;
And I am getting following error
Error in root2d (line 3)
F(1) = X(1) - exp(13.5-(2700/(x(3)-55)));
Error in fsolve (line 258)
fuser = feval(funfcn{3},x,varargin{:});
댓글 수: 0
답변 (1개)
Alan Stevens
2021년 1월 12일
Is it just a case of changing
F(1) = X(1) - exp(13.5-(2700/(x(3)-55)));
to
F(1) = x(1) - exp(13.5-(2700/(x(3)-55)));
댓글 수: 2
Alan Stevens
2021년 1월 13일
Your F expressions contain x(1) to x(5), but you only pass two values, [0, 0] to the function.
참고 항목
카테고리
Help Center 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!