How to solve linear and non linear equation system?

12 visualizzazioni (ultimi 30 giorni)
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!!!
  2 Commenti
Sameer il 4 Giu 2014
Hello....I made a mistake one equation was repeated twice, now i corrected it....these are 14 equations with 14 unknowns as v1 and p1 are known previously. Sohave to calculate 7 v's from v2-v8 and similarly 7 p's from p2-p8.

Accedi per commentare.

Risposta accettata

George Papazafeiropoulos
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
Roger Wohlwend
Roger Wohlwend il 5 Giu 2014
Forget a/b. That only works for linear systems.

Accedi per commentare.

Più risposte (1)

John D'Errico
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
Sameer il 5 Giu 2014
Hello John...I have already written the funtion and its working but what I am not able to understand is the passing of the initial assumed for zeros the answers are quite weird and when i am using ones then it gives the answers but with the following statement
Solver stopped prematurely.
fsolve stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 1400 (the default value).
So I am not able to understand what should I do, what to pass during the usage of fsolve
Can you please clarify how can I seclect the passing values?
any further guidance is highly appreciated.

Accedi per commentare.


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!

Translated by