How to plot inequalities

Try this: The red area is where both inequalities are satisfied.

[X,Y]=meshgrid(0:0.01:1,0:0.01:1); % Make a grid of points between 0 and 1
p1=0.1; p2=0.2; % Choose some parameters
ineq1 = Y<p2*(1-p1);
ineq2 = X<p1*(1-(Y./(1-p1)));
colors = zeros(size(X))+ineq1+ineq2;
scatter(X(:),Y(:),3,colors(:),'filled')

enter image description here

Leave a Comment