Home > Enterprise >  solve complex equations in MATLAB (Variable Equations)
solve complex equations in MATLAB (Variable Equations)

Time:02-05

I have some equations which include some parameters and variables. Each variable defines and also exists in other equations. these are my equations:

syms Pof s Pon teta landa PIon PIof PISC
Pof = (s * y - teta   T * teta - landa   Pi * landa   alpha * p   Pon * b1   w * b2)/(2 * b2);
s = -(y * (w - Pof))/q;
Pon = (q * s * y   2 * w * y - 2 * w * y^2   2 * q * alpha   2 * q * Pi * landa - q * teta   3 * q * T * teta - q * landa   q * Pi * landa - q * alpha * p - 2 * y * Pof   2 * y^2 * Pof   C * q * b1   q * w * b2)/(2 * q * b1);
teta = (C - 3 * C * T - Pon   3 * T * Pon)/2 * q;
landa = (-1/2) * (-1   Pi) * (C - Pon);
Don = (1-p) * alpha - b1 * Pon   b2 * Pof - (1-y) * s   T * teta   landa * Pi;
Dof = p * alpha - b1 * Pof   b2 * Pon   y * s - (1-T) * teta - landa * (1-Pi);
PIon = (Pon-C) * Don - (1/2) * n * teta^2 - (1/2) * q * landa^2;
PIof = (Pof-w) * Dof - (1/2) * L * s^2;
PISC = PIon   PIof;

How I can solve these in order to get a numeric answer for each variable? (I don't want parametric answers)

CodePudding user response:

The equations as stated are

fig1

which can be arranged as a linear system A x = b as follows

fig2

which you solve in Matlab as x = A \ b

On further investigation, it seems A is singular since it's 10×8 in size and cannot be inverted. So a least-squares solution is needed where

x = inv(AT* A)* AT b

  •  Tags:  
  • Related