How to solve equality and multiple inequality constraints at the same time?

1 vue (au cours des 30 derniers jours)
Yokuna
Yokuna le 26 Juin 2021
How can I solve the equations and plot x1 vs t.
%Initial conditions
x1=14; x2=14; x3=14;
%Equations
x1 =t*x1+x2+t*x3;
x2 = 2*t*x1+t*x2+x3;
x3 = t*x1+x2+t*x3;
% Inequality constraints
5<x1<20;
5<x2<20;
5<x3<20;

Réponses (2)

Walter Roberson
Walter Roberson le 28 Juin 2021
Modifié(e) : Walter Roberson le 28 Juin 2021
syms x1 x2 x3 t
x10 = 14; x20 = 14; x30 = 14; x0 = [x10,x20,x30];
eqns = [
x1 == t*x1+x2+t*x3
x2 == 2*t*x1+t*x2+x3;
x3 == t*x1+x2+t*x3;
x1 + x2 + x3 == 42;
]
eqns = 
sol3_partial = solve(eqns(end), x3)
sol3_partial = 
eqns2 = subs(eqns(1:end-1), x3, sol3_partial)
eqns2 = 
sol2_partial = solve(eqns2(1), x2)
sol2_partial = 
eqns3 = subs(eqns2(2:end), x2, sol2_partial)
eqns3 = 
sol1_partial = solve(eqns3(1), x1)
sol1_partial = 
eqns4 = subs(eqns3(2:end), x1, sol1_partial)
eqns4 = 
simplify(eqns4)
ans = 
sol1 = subs(sol1_partial, t, [0;5/2])
sol1 = 
We can see from that the 5/2 version does not satisfy the range constraints for x1
sol2 = subs(sol2_partial, {t, x1}, {0, 14})
sol2 = 
14
and using the equality constraint, we quickly deduce that x3 must be 14 as well.
So the only solution is [14, 14, 14] at time 0
(My internal reference for this is T0098941)

Rakshith G
Rakshith G le 22 Nov 2021
How can i solve this inequality function:
x1^2 + 2*x2^2 + 3*x3^2 <= 1
x1, x2, x3 >= 0
Need to find all the values of x1, x2 and x3

Catégories

En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by