MATLAB: Coloring region of inequalities on matlab

#matlab #regioncolorMATLAB

I would like to color the region for the inequalities listed: 0.00383p + 0.804t > -1250; 0.00383p + 0.804t < 1500. How can I color the region with respect to these inequalities in a 2D coordinate system of t vs. p?

Best Answer

Download plotregion from the file exchange. It does exactly what you want. Although, I should point out that this is an unbounded region. Two inequalities are insufficient to bound a region in the plane. As it is, these are parallel lines, so the region extends to infinity in either direction, unless there are also other constraints, perhaps positivity of the variables.
Alternatively, it is trivial to create a polygon that goes out as far as you wish. Then just use patch.