How do I solve multivariable equation system?

6 views (last 30 days)
Hello,
I'm trying to solve 3 equation system with 3 variables. I have implemented code presented below:
syms kp Ti Td
lambda = 5;
ksi = sqrt(2)/2;
omega = 50;
Eqs = [((0.8*Ti+0.4*kp*Ti+Td*Ti*kp)/(0.3*Ti+0.4*Td*Ti*kp) == (lambda*omega*ksi + 2*ksi*omega)),
((+1.5*Ti+0.4*kp+kp*Ti)/(0.3*Ti+0.4*Td*Ti*kp) == (omega^2 + 2*ksi^2*omega^2*lambda)),
(kp/(0.3*Ti+0.4*Td*Ti*kp) == lambda*omega^3*ksi)];
[sol_kp, sol_Td, sol_Ti] = solve(Eqs,kp,Td,Ti);
sol_kp = double(sol_kp)
sol_Ti = double(sol_Ti)
sol_Td = double(sol_Td)
ogr1 = 0.3*sol_Ti+0.4*sol_Td*sol_Ti*sol_kp;
ogr2 = 0.8*sol_Ti+0.4*sol_Ti*sol_kp+sol_Td*sol_Ti*sol_kp;
ogr3 = 1.5*sol_Ti+0.4*sol_kp+sol_Ti*sol_kp;
ogr4 = sol_kp;
s1 = ogr2/ogr1 - lambda*omega*ksi - 2*ksi*omega
s2 = ogr3/ogr1 - omega^2 + 2*ksi^2*omega^2*lambda
s3 = ogr4/ogr1 - lambda*omega^3*ksi
I obtained a solution (sol_kp, sol_Td, sol_Ti). To check whether solution is appropriate, I have computed values of s1-3 (they should be zero if the solution is correct, unfortunately they are not). I double checked equations and they seems to be right. Could you tell me if I made a mistake using the solve () function ?

Accepted Answer

Torsten
Torsten on 16 Oct 2015
s2 = ogr3/ogr1 - omega^2 - 2*ksi^2*omega^2*Lambda
instead of
s2 = ogr3/ogr1 - omega^2 + 2*ksi^2*omega^2*Lambda
Best wishes
Torsten.
  3 Comments
Torsten
Torsten on 16 Oct 2015
Is this also the case if you call solve as
[sol_kp, sol_Td, sol_Ti] = solve(Eqs,[kp,Td,Ti]);
?
Best wishes
Torsten.
Krzysztof Lakomy
Krzysztof Lakomy on 16 Oct 2015
Unfortunately, when I'm calling like this, I obtain empty variables and matlab returns warning:
Warning: 6 equations in 3 variables.
> In C:\Program Files\MATLAB\R2012a\toolbox\symbolic\symbolic\symengine.p>symengine at 54
In mupadengine.mupadengine>mupadengine.evalin at 97
In mupadengine.mupadengine>mupadengine.feval at 150
In solve at 160
In ED_PID_synt at 20
Warning: Explicit solution could not be found.
> In solve at 169
In ED_PID_synt at 20

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!