solve set of inequalities and plot the solution

2 vues (au cours des 30 derniers jours)
Gaetano Pavone
Gaetano Pavone le 15 Mai 2025
Commenté : Gaetano Pavone le 16 Mai 2025
I want to solve the following inequalities and then plot the solution:
syms alpha beta
eq_E_Bar=0.0664057051742095*alpha+beta*(-0.0900076050430003)<=0;
eq_I_Bar=-0.147476397055133*alpha+beta*(-0.160063987615969)<=0;
eq_I_CD=-0.122381054306963*alpha+beta*(0.125233998946155)>=0;
eq_CH=0.0733606912576878*alpha+beta*(0.0218230571691888)>=0;
eq_E_CD=-0.00347678534715134*alpha+beta*(0.0182604037132820)>=0;
eq_CI=-0.0559753491327545*alpha+beta*(0.0352263939031544)>=0;
feasible_sol=solve([eq_E_Bar,eq_I_Bar,eq_I_CD,eq_CH,eq_E_CD,eq_CI],[alpha beta],ReturnConditions=true)
feasible_sol = struct with fields:
alpha: (2256015163952083*x1)/2204621082296188 + x beta: x1 parameters: [x x1] conditions: 10549189801660689702269137781572*x <= 3503468021860192787493706908071*x1 & 0 <= 5827028370741121936647379822184*x + 7696269995943263088326695380347*x1 & 177844533…
cond=feasible_sol.conditions
cond = 
Is my code correct?

Réponse acceptée

Torsten
Torsten le 15 Mai 2025
Modifié(e) : Torsten le 15 Mai 2025
A = [-0.0664057051742095,0.0900076050430003;...
0.147476397055133,0.160063987615969;...
-0.122381054306963,0.125233998946155;...
0.0733606912576878,0.0218230571691888;...
-0.00347678534715134,0.0182604037132820;...
-0.0559753491327545,0.0352263939031544];
b = [0;0;0;0;0;0];
lb = [-100;-100];
ub = [100; 100];
plotregion(A,b,lb,ub);
Download "plotregion" from
It's not clear what you mean by "solve the inequalities". The plot suggests that two of the inequalities are the relevant ones. So the "solution" is given by the intersection of the regions defined by two out of the six inequalities you posted.

Plus de réponses (0)

Tags

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by