using "solve" for a system of nonlinear equations
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a set of 6 nonlinear equations as follows (a1,a2,a3,b1,b2,b3 are unknowns). I know that one of the answers of this system must be as following: a1=3, a2=1, a3=3, b1=0.2, b2=0.3, b3=0.4 (it exactly satisfies my equations). When I use "solve" it gives me 4 different set of answers but surprisingly none of them is the above mentioned answer that I am anticipating. In fact "solve" is neglecting at least one of the answers of this system. How can I adjust or use "solve" to give me that answer?
syms a1 a2 a3 b1 b2 b3
X1=0.16;
X2=0.9466667;
X3=2.97;
Z1=2.97;
Z2=0.9866667;
Z3=0.38;
[a1, a2, a3, b1, b2, b3]=solve(X1==b1-b2*b3/a1,X2==a2-b3^2/a1,X3==a3-b2^2/a1,Z1==a1-b2^2/a3,Z2==a2-b1^2/a3,Z3==b3-b1*b2/a3);
a1=eval(a1)
a2=eval(a2)
a3=eval(a3)
b1=eval(b1)
b2=eval(b2)
b3=eval(b3)
2- Do you know any other command or user defined function to use for solving system of nonlinear equations and gives me all the answers ? (does not require initial guess like fsolve)
0 Commenti
Risposte (1)
Matt J
il 25 Set 2014
Modificato: Matt J
il 25 Set 2014
2- Do you know any other command or user defined function to use for solving system of nonlinear equations and gives me all the answers ? (does not require initial guess like fsolve)
No, that's not possible for general nonlinear equations and numerical solvers. The set of solutions can be infinite for example, as in the system
x-y=0
x^2-y^2=0
When I use "solve" it gives me 4 different set of answers but surprisingly none of them is the above mentioned answer that I am anticipating.
What answers does it give you?
6 Commenti
Matt J
il 26 Set 2014
If you have the Global Optimization Toolbox, you could try MultiStart
This would involve basically rewriting the objective function as a least squares problem. MultiStart then manages the running of a least squares minimization algorithm from many starting points and can find multiple solutions.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!