solve simultaneous non-linear equation system using fsolve
Mostrar comentarios más antiguos
Hi everyone,
I'm a beginner in matlab. I want to solve simultaneous non-linear equation system using fsolve. (pardon my english)
anyone have any idea how to do it? I read about making separate program then call it in the other program, but I'm confused which one should call which one.
When I tried to run the program, the command window told me:
Undefined function or variable 'x'.
Error in Modelsingletray (line 47)
EC=(1+(4.516*(10^-12)*x(1)+0.33368*x(10)+1.906*(10^-12)*x(8)))^0.5;
I have the codes attached. Any help is appreciated. Thank you
3 comentarios
Star Strider
el 10 de Mayo de 2019
You need to rewrite your code so that averything ‘myfun’ needs to calculate that are functions of ‘x’ are calculated within it, using the ‘x’ vector supplied to it by fsolve.
The statements must be in the correct order, so that the values needed later in the code are calculated first.
For example:
pC=yC*P;
appears under ‘%outlet gas partial pressure’ however
yC=NC/(NC+NH+G2-NW+NCH);
is calculated later in ‘%outlet gas composition’
I am certain you can get your code to run successfully. However you need to write ‘myfun’ so that it calculates its variables in the correct order. Then use fsolve to optimise ‘myfun’, returning the optimal values for ‘x’.
Bertiningrum Devi
el 10 de Mayo de 2019
Editada: Bertiningrum Devi
el 10 de Mayo de 2019
Star Strider
el 10 de Mayo de 2019
My pleasure.
A loop is an option, however that may not solve the problem. You likely need to make them into simultaneous equations that include all the variables, and then solve the system. That will probably require re-writing your code.
Respuestas (1)
Sulaymon Eshkabilov
el 10 de Mayo de 2019
0 votos
Your problem is not explcit. Some addtional expressions and/or input data are needed for mass transfer fluxes, gas partial prsssure, etc.
Categorías
Más información sobre Physics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!