am obtaining errors while solving equations by fsolve

1 visualización (últimos 30 días)
sabarish
sabarish el 28 de Jul. de 2014
Comentada: Star Strider el 8 de Ag. de 2014
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 comentarios
Matt J
Matt J el 28 de Jul. de 2014
Editada: Matt J el 28 de Jul. de 2014
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 el 30 de Jul. de 2014
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

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 28 de Jul. de 2014
See if:
x0=[5,5,5,5,5];
x = fsolve(@myfun,x0);
improves things.
  2 comentarios
sabarish
sabarish el 30 de Jul. de 2014
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 el 30 de Jul. de 2014
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.

Iniciar sesión para comentar.

Más respuestas (1)

sabarish
sabarish el 8 de Ag. de 2014
thanks for your help.

Categorías

Más información sobre Multiobjective Optimization en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by