필터 지우기
필터 지우기

Solving nonlinear system using Fsolve function

조회 수: 2 (최근 30일)
Sara
Sara 2011년 7월 14일
Hello,
I am trying to solve for this system of nonlinear equations in matlab:
function f = nle(x)
x=x(1); y=x(2);
f(1)=((2.5+y-0.5*x)^.5)*(4-x)/b*((19.84+y-0.5*x)^0.5)-874.9837752; f(2)=((2.5+y-0.5*x)^.5)*d/(3-y)*((19.84+y-0.5*x)^0.5)-2558585887;
In the command window I type:
x0=[1 1] fsolve=('nle',xo)
and then I get an error that says:
??? Attempted to access x(2); index out of bounds because numel(x)=1.
Error in ==> nle at 4 y=x(2);
Error in ==> fsolve at 254 fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
I do not understand what the error means. Someone Please help!!
Thank you
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2011년 7월 14일
Please format you question: http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question

댓글을 달려면 로그인하십시오.

답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 7월 14일
x = x(1);
y = x(2)
you overwrite x by saying x = x(1)...

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by