am obtaining errors while solving equations by fsolve

1 回表示 (過去 30 日間)
sabarish
sabarish 2014 年 7 月 28 日
コメント済み: Star Strider 2014 年 8 月 8 日
my coding function F = myfun(x) F=[(((x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^2); ((((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+(x(5)*(1+x(1)+x(2)))*(-0.15335))*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^2)-(2*(((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^3)); ((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)))*0.15335+(3*(x(5)*(-x(1)*x(3)*(-x(3)-1))+((x(2)*x(4))*(x(4)-1)))*0.034077)+(3*((x(5)*(-x(1)*x(3)))+(x(2)*x(4)))*(-0.15335))+((x(5)*(1+x(1)+x(2)))*(-0.383645))*((1+(x(5)*(1+x(1)+x(2)))*0.15335)^2)-(6*(2*((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+(x(5)*(1+x(1)+x(2))*0.034077)))*((((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+(x(5)*(1+x(1)+x(2)))*(-0.15335))*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^2)-(6*(((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077))))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^4)); (((x(5)*((-x(1)*x(3))*(-x(3)-1)*(-x(3)-2)*(-x(3)-3))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)*(x(4)-3)))*0.15335)+(4*(x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)))*0.034077)+(6*(x(5)*(-x(1)*x(3)*(-x(3)-1))+((x(2)*x(4))*(x(4)-1)))*(-0.15335))+(4*((x(5)*(-x(1)*x(3)))+(x(2)*x(4)))*(-0.383645))+(((x(5)*(-x(1)*x(3)))+(x(2)*x(4))*(-0.5437)))*(((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^3))-((6*((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+((x(5)*(1+x(1)+x(2)))*(-0.15335)))^2)*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^2)-(8*(((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077))))*((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)))*0.15335+(3*(x(5)*(-x(1)*x(3)*(-x(3)-1))+((x(2)*x(4))*(x(4)-1)))*0.034077)+(3*((x(5)*(-x(1)*x(3)))+(x(2)*x(4)))*(-0.15335))+((x(5)*(1+x(1)+x(2)))*(-0.383645))*((1+(x(5)*(1+x(1)+x(2)))*0.15335)^2)-(6*(2*((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+(x(5)*(1+x(1)+x(2))*0.034077)))*((((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+(x(5)*(1+x(1)+x(2)))*(-0.15335))*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^2)-(6*(x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))))/(((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^5)); ((((x(5)*((-x(1)*x(3))*(-x(3)-1)*(-x(3)-2)*(-x(3)-3)*(-x(3)-4))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)*(x(4)-3)*(-x(4)-4)))*0.153355)+(5*(x(5)*((-x(1)*x(3))*(-x(3)-1)*(-x(3)-2)*(-x(3)-3))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)*(x(4)-3)))*0.034077)+(10*(x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)))*(-0.15335))+(10*(x(5)*(-x(1)*x(3)*(-x(3)-1)+((x(2)*x(4))*(x(4)-1)))*(-0.383645)))+(5*((x(5)*(-x(1)*x(3)))+(x(2)*x(4)))*(-0.5437)+((x(5)*(1+x(1)+x(2)))*(-0.927345))))*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)^4)-(20*(((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+(x(5)*(1+x(1)+x(2)))*(-0.15335)))+(((x(5)*((-x(1)*x(3))*(-x(3)-1)*(-x(3)-2)*(-x(3)-3))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)*(x(4)-3)))*0.15335)+(4*(x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)))*0.034077)+(6*(x(5)*(-x(1)*x(3)*(-x(3)-1))+((x(2)*x(4))*(x(4)-1)))*(-0.15335))+(4*((x(5)*(-x(1)*x(3)))+(x(2)*x(4)))*(-0.383645))+(((x(5)*(-x(1)*x(3)))+(x(2)*x(4))*(-0.5437)))*(((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^3))-((6*((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+((x(5)*(1+x(1)+x(2)))*(-0.15335)))^2)*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^2)-(8*(((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077))))*((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2))+((x(2)*x(4))*(x(4)-1)*(x(4)-2)))*0.15335+(3*(x(5)*(-x(1)*x(3)*(-x(3)-1))+((x(2)*x(4))*(x(4)-1)))*0.034077)+(3*((x(5)*(-x(1)*x(3)))+(x(2)*x(4)))*(-0.15335))+((x(5)*(1+x(1)+x(2)))*(-0.383645))*((1+(x(5)*(1+x(1)+x(2)))*0.15335)^2)-(6*(2*((x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+(x(5)*(1+x(1)+x(2))*0.034077)))*((((x(5)*(-x(1)*x(3)*(-x(3)-1)*(-x(3)-2)+(x(2)*x(4))*(x(4)-1)*(x(4)-2))*0.15335)+2*x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.034077+(x(5)*(1+x(1)+x(2)))*(-0.15335))*((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^2)-(6*(x(5)*(-x(1)*x(3))+(x(2)*x(4)))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077))))))/(((1+(x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335))^6))]; x0=[5,5]; fslove(@myfun,x0); end
am getting errors
my errors Error in ==> myfun at 2 F=[(((x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^2);
Error in ==> fsolve at 248 fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
??? Input argument "x" is undefined.
Error in ==> myfun at 2 F=[(((x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^2); >>
kindly help me out to solve the errors
  2 件のコメント
Matt J
Matt J 2014 年 7 月 28 日
編集済み: Matt J 2014 年 7 月 28 日
The code you've shown cannot be the actual code you are running. You have misspelled "fsolve", for example, which should have produced different error messages than what you've shown.
sabarish
sabarish 2014 年 7 月 30 日
sorry Mr.Matt j,i misspelled while here Attempted to access x(5); index out of bounds because numel(x)=2.
Error in ==> myfun at 2 F=[(((x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^2);
Error in ==> fsolve at 248 fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. am getting here while running with mfile. and also if i give command ordinarily outside the mfile means gettingerror like this Attempted to access x(5); index out of bounds because numel(x)=2.
Error in ==> myfun at 2 F=[(((x(5)*(-x(1)*x(3))+(x(2)*x(4))*0.15335)+((x(5)*(1+x(1)+x(2))*0.034077)))/((1+(x(5)*(1+x(1)+x(2)))*0.15335))^2);
Error in ==> fsolve at 248 fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
please help me to figure out to find errors

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

採用された回答

Star Strider
Star Strider 2014 年 7 月 28 日
See if:
x0=[5,5,5,5,5];
x = fsolve(@myfun,x0);
improves things.
  2 件のコメント
sabarish
sabarish 2014 年 7 月 30 日
thanks Mr.Star Strider. but it producing another error ??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer.
Error in ==> optimget>optimgetfast
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
i tried to improve my stack size.but while am increasing my sixe my matlab programme automatically quit the all windows. what i do to solve the equatios
Star Strider
Star Strider 2014 年 7 月 30 日
The RecursionLimit message means that you are calling fsolve from within your function.
Remove all calls to fsolve within your function. All calls to fsolve should be outside your function, in your main script.

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

その他の回答 (1 件)

sabarish
sabarish 2014 年 8 月 8 日
thanks for your help.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by