Plotting 2-D regions without prior knowing the numeric limits

Hello,
I'm trying to plot a closed 2-D region defined by a set of linear inequalities (it could be a triangle, rectangle, etc., you know). Those inequalities are defined using symbolic variables and their coeficients are results from previous calculations. I tried using solve function (with 'returnconditions' to true) but I can't extract the validity intervals of the variables from the result.
I saw other answers around this topic that defined a meshgrid and checked if the conditions hold at each point of the grid. The problem is that I don't have the knowledge of the limits of the region I'm trying to plot, so I can't define a grid.
As an example, from one of the runs, i get a "1x4 sym":
[ 13/10 < K1 + 2*K2, -1/5 < 2*K2 - K1, 1/10 - (23*5^(1/2))/50 < - K1 - K2/2 - (5^(1/2)*K2)/5, - (23*5^(1/2))/50 - 1/10 < K1 + K2/2 - (5^(1/2)*K2)/5]
where K1 and K2 are the variables.
I would like to obtain the lowest and highest K1 and K2 that allow the conditions to be true, so I can make the meshgrid and plot the result. If that's not posible, obtaining a set of points satisfying the inequality system could be useful (as long as the points are distributed along the region).
Thanks for your help.

 Accepted Answer

3 Comments

Thank you for your answer, but I need more help. Could you explain how can I obtain the matrix A and b from the sym variable that I have so I can use plotregion?
Could you explain how can I obtain the matrix A and b from the sym variable that I have so I can use plotregion?
Maybe
can help, but once you get A and b treating your inequalities as equalities, i think you will have to change the signs of the i-th row of A and the element b(i) manually if the resulting inequality would be >= instead of <=.
Do you understand what I mean ?
Here is another plotting tool once you have A and b correctly:
Yes, I think I can resolve it now. Thank you so much for your help.

Sign in to comment.

More Answers (0)

Products

Release

R2019b

Asked:

on 15 Jul 2022

Edited:

on 15 Jul 2022

Community Treasure Hunt

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

Start Hunting!