How to solve linear and non linear equation system?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sameer
il 4 Giu 2014
Commentato: Sameer
il 5 Giu 2014
Hello
Can anyone tell me how I can solve the following system of equation
1) a1v1-a2v2-a3v3-a4v4=0
2) a3v3-a5v5-a6v6=0
3) a2v2+a6v6-a7v7=0
4) a7v7+a5v5+a4v4-a8v8=0
5) 500v1^2+p1-p2-500v2^2=0
6) 500v1^2+p1-p3-500v3^2=0
7) 500v1^2+p1-p4-500v4^2=0
8) 500v3^2+p3-p5-500v5^2=0
9) 500v3^2+p3-p6-500v6^2=0
10) 500v7^2+p7-p2-500v2^2=0
11) 500v7^2+p7-p6-500v6^2=0
12) 500v8^2+p8-p4-500v4^2=0
13) 500v8^2+p8-p5-500v5^2=0
14) 500v8^2+p8-p7-500v7^2=0
How to solve the above equation system for v's and p's where v1 and p1 are known
Please guide!!!
Regards
2 Commenti
George Papazafeiropoulos
il 4 Giu 2014
15 equations for 16 unknowns... is it supposed to have a specific 16-number solution?
Risposta accettata
George Papazafeiropoulos
il 4 Giu 2014
Modificato: George Papazafeiropoulos
il 4 Giu 2014
For 14 equations with 14 unknowns, try fsolve, or any other iterative solver (Newton-Raphson, Arc-Length, line search, etc...) Make a function which takes 14-element vectors, and gives as output the left-hand sides of the 14 equations. Then you will try to make this function equal to zero.
7 Commenti
Più risposte (1)
John D'Errico
il 4 Giu 2014
Modificato: John D'Errico
il 4 Giu 2014
You have 14 equations. And it looks like 16 variables, {v1,...,v8,p1,...,p8}.
But you tell us that v1 and p1 are known, so effectively only 14 unknowns. With as many equations as unknowns, there will OFTEN be exact solution(s), but there is no assurance thereof. In fact, for nonlinear problems, there will often be multiple solutions. (See below.)
Worse, the equations are mostly quadratic in the variables. So the system would correspond to a quite high order polynomial equation, on the order of 25. So no exact solution is available in any event, since the effective degree is greater than 5.
At best you can solve for numerical solutions, using a tool like lsqnonlin or fsolve, ASSUMING that you will provide values for all known variables. If they are left as symbolic variables, you will fail.
There will be many such solutions, so different starting values will yield different solutions. I describe the idea of a basin of attraction in my optimization tips and tricks doc on the file exchange. Effectively, if you start an optimizer anywhere in the basin of a given solution, it will converge to that solution. Such basins will not in general be convex sets, since there will be many solutions.
Edit: I talked about an effective degree before. With polynomial problems as we have here, suppose we had TWO quadratic equations in TWO unknowns. A "simple" version of your problem, sort of. The idea would be to use the quadratic formula to solve for one variable in one of the equations. Then substitute back into the other equation. This will generally yield a FOURTH order polynomial problem to solve. So a system of two quadratic equations in two unknowns is equivalent to an effective total order of 4.
A system with a dozen quadratic equations, plus some linear equations, will be equivalent to at least an effective order of 25 or so. This tells me there will be no symbolic solution to be found, unless you were very lucky. In real life, you never get lucky on these things. (Were it homework, you often get lucky.)
6 Commenti
John D'Errico
il 5 Giu 2014
As I said. Use fsolve (or lsqnonlin, depending on what toolboxes you have.) My writing it for you won't help you to learn how to use fsolve. It will just solve your immediate problem. The doc for fsolve has examples anyway.
Remember what I said before, that depending on the starting values you choose, you will get different solutions. But since any solution IS a solution, you don't care, unless you need all of the solutions. In that case, expect some work chasing them all down.
Vedere anche
Categorie
Scopri di più su Systems of Nonlinear Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!