Prev: mscohere
Next: Interpreting data from multcompare
From: Ali Modirkhazeni on 13 Nov 2009 10:45 Hi firends I want to solve the set of non linear set of equitations as follow : (I define them in Function Che1) : function y = Che1(x) R = 8.314; T = 1000; DF_CH4 = 19720; DF_H2O = -192420; DF_CO = -200240; DF_CO2 = -395790; RT = R*T; y = [ DF_CH4/RT + log(x(1)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + 4*x(8)/RT; DF_H2O/RT + log(x(5)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + 2*x(8)/RT + x (7)/RT; DF_CO/RT + log(x(3)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + x(7)/ RT; DF_CO2/RT + log(x(4)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + 2*x (7)/RT; log(x(2)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + 2*x(8)/RT; x(1) + x(3) + x(4) - 2; 4*x(1) + 2*x(5) + 2*x(2) -14; x(5) + x(3) + 2*x(4) - 3; log(x(1)) + log(x(2)) + log(x(3)) + log(x(4)) + log(x(5)) + 3.1011] ; end But Matlab Makes an error The errors are as follow : ??? Error using ==> vertcat CAT arguments dimensions are not consistent. Error in ==> Che1 at 9 y = [ DF_CH4/RT + log(x(1)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + 4*x(8)/RT; Error in ==> fsolve at 249 fuser = funfcn{3}(x,varargin{:}); Error in ==> solve_set at 4 y = fsolve(@Che1,x0,option); Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. Please Help Me I really need to solve this set of nonlinear equations . Thanks a lot
From: Alan Weiss on 16 Nov 2009 15:46 I am not sure what is wrong here, but did you try to evaluate your function Che1 at your x0 point? It seems to me that the error is not an fsolve problem, it is a function definition problem. Alan Weiss MATLAB mathematical toolbox documentation Ali Modirkhazeni wrote: > Hi firends > I want to solve the set of non linear set of equitations as follow : > (I define them in Function Che1) : > > function y = Che1(x) > R = 8.314; > T = 1000; > DF_CH4 = 19720; > DF_H2O = -192420; > DF_CO = -200240; > DF_CO2 = -395790; > RT = R*T; > y = [ DF_CH4/RT + log(x(1)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + > 4*x(8)/RT; > DF_H2O/RT + log(x(5)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + 2*x(8)/RT + x > (7)/RT; > DF_CO/RT + log(x(3)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + x(7)/ > RT; > DF_CO2/RT + log(x(4)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + 2*x > (7)/RT; > log(x(2)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + 2*x(8)/RT; > x(1) + x(3) + x(4) - 2; > 4*x(1) + 2*x(5) + 2*x(2) -14; > x(5) + x(3) + 2*x(4) - 3; > log(x(1)) + log(x(2)) + log(x(3)) + log(x(4)) + log(x(5)) + > 3.1011] ; > end > But Matlab Makes an error The errors are as follow : > > ??? Error using ==> vertcat > CAT arguments dimensions are not consistent. > > Error in ==> Che1 at 9 > y = [ DF_CH4/RT + log(x(1)/((x(1)+x(2)+x(3)+x(4)+x(5)))) + x(6)/RT + > 4*x(8)/RT; > > Error in ==> fsolve at 249 > fuser = funfcn{3}(x,varargin{:}); > > Error in ==> solve_set at 4 > y = fsolve(@Che1,x0,option); > > Caused by: > Failure in initial user-supplied objective function evaluation. > FSOLVE cannot > continue. > > Please Help Me > I really need to solve this set of nonlinear equations . > > Thanks a lot
|
Pages: 1 Prev: mscohere Next: Interpreting data from multcompare |