How to solve equality and multiple inequality constraints at the same time?
    7 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
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;
0 commentaires
Réponses (2)
  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;
    ]
sol3_partial = solve(eqns(end), x3)
eqns2 = subs(eqns(1:end-1), x3, sol3_partial)
sol2_partial = solve(eqns2(1), x2)
eqns3 = subs(eqns2(2:end), x2, sol2_partial)
sol1_partial = solve(eqns3(1), x1)
eqns4 = subs(eqns3(2:end), x1, sol1_partial)
simplify(eqns4)
sol1 = subs(sol1_partial, t, [0;5/2])
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})
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)
0 commentaires
  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
0 commentaires
Voir également
Catégories
				En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!











