Prev: format_ticks.m
Next: plotting
From: Gavin on 15 Jun 2010 18:46 "Gavin " <wigging(a)gmail.com> wrote in message <hv876f$qgn$1(a)fred.mathworks.com>... > Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <800314764.348942.1276611471963.JavaMail.root(a)gallium.mathforum.org>... > > if yCO<=0; yCO=1e-20; end > if yCO2<=0; yCO2=1e-20; end > if yH2O<=0; yH2O=1e-20; end > if yH2<=0; yH2=1e-20; end > if yH<=0; yH=1e-20; end > if yN<=0; yN=1e-20; end > if yN2<=0; yN2=1e-20; end > if yNO<=0; yNO=1e-20; end > if yO2<=0; yO2=1e-20; end > if yO<=0; yO=1e-20; end > if yOH<=0; yOH=1e-20; end Even when using the "if" statements I still get negative values at low temperature ranges. This is still incorrect.
From: Torsten Hennig on 15 Jun 2010 22:45 > "Gavin " <wigging(a)gmail.com> wrote in message > <hv876f$qgn$1(a)fred.mathworks.com>... > > Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> > wrote in message > <800314764.348942.1276611471963.JavaMail.root(a)gallium. > mathforum.org>... > > > > if yCO<=0; yCO=1e-20; end > > if yCO2<=0; yCO2=1e-20; end > > if yH2O<=0; yH2O=1e-20; end > > if yH2<=0; yH2=1e-20; end > > if yH<=0; yH=1e-20; end > > if yN<=0; yN=1e-20; end > > if yN2<=0; yN2=1e-20; end > > if yNO<=0; yNO=1e-20; end > > if yO2<=0; yO2=1e-20; end > > if yO<=0; yO=1e-20; end > > if yOH<=0; yOH=1e-20; end > > Even when using the "if" statements I still get > negative values at low temperature ranges. This is > still incorrect. If by 'negative' you mean values for the mole fractions in the order of -1e-6, you can interprete them as 0. If you don't want to get 'negative' values, just substitute _all_ mole fraction in _all_ your equations by their squares. When you then get the solution vector [y1,...,y_n] from fsolve, your true solution is [(y1)^2,...,(y_n)^2]. That's what I meant by: don't forget to retransform the variables of which you took the square in your problem formulation. Best wishes Torsten.
From: Gavin on 16 Jun 2010 23:20 Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <324982408.352424.1276670740011.JavaMail.root(a)gallium.mathforum.org>... > > > > Even when using the "if" statements I still get > > negative values at low temperature ranges. This is > > still incorrect. > > If by 'negative' you mean values for the mole fractions > in the order of -1e-6, you can interprete them as 0. > If you don't want to get 'negative' values, just > substitute _all_ mole fraction in _all_ your equations > by their squares. > When you then get the solution vector [y1,...,y_n] > from fsolve, your true solution is [(y1)^2,...,(y_n)^2]. > That's what I meant by: don't forget to retransform > the variables of which you took the square in your > problem formulation. > > Best wishes > Torsten. Torsten, It seems safe to assume that the solution value is zero if it's negative. I have added this assumption to the solve file. I plan to make more changes to the system and will reply if I have any other questions or problems. Thank you for all the help you have given and please monitor this thread for updates on this.
From: Steve Amphlett on 17 Jun 2010 05:58 "Gavin " <wigging(a)gmail.com> wrote in message <hvc49l$6e0$1(a)fred.mathworks.com>... > Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <324982408.352424.1276670740011.JavaMail.root(a)gallium.mathforum.org>... > > > > > > Even when using the "if" statements I still get > > > negative values at low temperature ranges. This is > > > still incorrect. > > > > If by 'negative' you mean values for the mole fractions > > in the order of -1e-6, you can interprete them as 0. > > If you don't want to get 'negative' values, just > > substitute _all_ mole fraction in _all_ your equations > > by their squares. > > When you then get the solution vector [y1,...,y_n] > > from fsolve, your true solution is [(y1)^2,...,(y_n)^2]. > > That's what I meant by: don't forget to retransform > > the variables of which you took the square in your > > problem formulation. > > > > Best wishes > > Torsten. > > Torsten, > > It seems safe to assume that the solution value is zero if it's negative. I have added this assumption to the solve file. I plan to make more changes to the system and will reply if I have any other questions or problems. Thank you for all the help you have given and please monitor this thread for updates on this. This system of equations is very difficult to solve using traditional methods. When your concentrations approach zero, some of the equations are either no longer valid or just go crazy (division by near zero). I'd be suprised if simply packaging them up and passing them to a canned solver is going to work without a lot of fiddling. I would search the literature for custom solvers for this well-known problem and implement them directly in Matlab.
From: Gavin on 17 Jun 2010 09:22
"Steve Amphlett" <Firstname.Lastname(a)Where-I-Work.com> wrote in message <hvcrjd$oug$1(a)fred.mathworks.com>... > > This system of equations is very difficult to solve using traditional methods. When your concentrations approach zero, some of the equations are either no longer valid or just go crazy (division by near zero). I'd be suprised if simply packaging them up and passing them to a canned solver is going to work without a lot of fiddling. I would search the literature for custom solvers for this well-known problem and implement them directly in Matlab. Steve, Would you happen to know of any such solvers that I could apply to this problem? Thanks. |