fsolve returns a complex solution instead of a real one

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fsolve returns a complex solution instead of a real one

Loro51
Dear All,

Maybe I am doing something wrong. In this case, please let me know

I develop a simple code to calculate the chemical equilibrium from a
composition at some temperature and on the uploaded file you can find the
equations.

As I run CC_Micro_Turbina_Gas_Trabalho_BE on the Command Window on Debian 9
(Octave version 4.0.3) I get a complex solution with info = 3 instead of a
real solution as it should be. What am I doing wrong?

All the properties were tested and are Ok

All the best


CC_Micro_Turbina_Gas_Trabalho_BE.m
<http://octave.1599824.n4.nabble.com/file/t373382/CC_Micro_Turbina_Gas_Trabalho_BE.m>  




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: fsolve returns a complex solution instead of a real one

Doug Stewart-4


On Sun, Jun 9, 2019 at 9:18 AM Loro51 <[hidden email]> wrote:
Dear All,

Maybe I am doing something wrong. In this case, please let me know

I develop a simple code to calculate the chemical equilibrium from a
composition at some temperature and on the uploaded file you can find the
equations.

As I run CC_Micro_Turbina_Gas_Trabalho_BE on the Command Window on Debian 9
(Octave version 4.0.3) I get a complex solution with info = 3 instead of a
real solution as it should be. What am I doing wrong?

All the properties were tested and are Ok

All the best


CC_Micro_Turbina_Gas_Trabalho_BE.m
<http://octave.1599824.n4.nabble.com/file/t373382/CC_Micro_Turbina_Gas_Trabalho_BE.m




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


I tried to run your code but it says:
error: 'g_CO' undefined near line 53 column 13

--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: fsolve returns a complex solution instead of a real one

tmacchant
In reply to this post by Loro51
----- Original Message -----

> From: Loro51 
> To: help-octave
> Cc:
> Date: 2019/6/9, Sun 09:22
> Subject: fsolve returns a complex solution instead of a real one
>
> Dear All,
>
> Maybe I am doing something wrong. In this case, please let me know
>
> I develop a simple code to calculate the chemical equilibrium from a
> composition at some temperature and on the uploaded file you can find the
> equations.
>
> As I run CC_Micro_Turbina_Gas_Trabalho_BE on the Command Window on Debian 9
> (Octave version 4.0.3) I get a complex solution with info = 3 instead of a
> real solution as it should be. What am I doing wrong?
>
> All the properties were tested and are Ok
>
> All the best
>
>
Document of fsolve states :

options is a structure specifying additional parameters which control the algorithm. 
Currently, fsolve recognizes these options:
"AutoScaling", "ComplexEqn", "FinDiffType", "FunValCheck", "Jacobian", 
"MaxFunEvals", "MaxIter", "OutputFcn", "TolFun", "TolX", "TypicalX", and "Updating".

Did you specify "ComplexEqn" option?

Tatsuro