Hello community
I'm looking for help, please.
How can I find unknowns from inequations?
Here is an example:
24+x1<= 50
24+x2<= 206
x2-x1<=245
-x2+x1<=361
I need x1 and x2

 Réponse acceptée

KSSV
KSSV le 31 Jan 2023

0 votes

Read about linprog

7 commentaires

Imanitxka imane
Imanitxka imane le 31 Jan 2023
For linprog i think we must have an objective function,,, but here we dont have it
Torsten
Torsten le 31 Jan 2023
Modifié(e) : Torsten le 31 Jan 2023
What is your final aim ?
Do you only want to get a single point that satisfies all constraints ?
Do you want to graph the feasible region in 2d as a polygon ? Because there are many (x1,x2) pairs that "solve" your system of inequalities in general.
For the latter, you could use
Imanitxka imane
Imanitxka imane le 31 Jan 2023
I want to get just single point x1 and x2
Torsten
Torsten le 31 Jan 2023
Modifié(e) : Torsten le 31 Jan 2023
f = [0 0];
ub = [50-24,206-24];
A = [-1 1;1 -1];
b = [245;361];
sol = linprog(f,A,b,[],[],[],ub)
Optimal solution found.
sol = 2×1
26 26
Imanitxka imane
Imanitxka imane le 31 Jan 2023
Thanks ,,, Plz can you re-write the inequalities that you have solved through this code
Torsten
Torsten le 31 Jan 2023
These are the ones from your original question above.
Imanitxka imane
Imanitxka imane le 31 Jan 2023
Thank you so much for your help

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by