如何绘制不平等 [英] How to plot inequalities
本文介绍了如何绘制不平等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想画出以下不等式: y < p 2 (1- p 1 )和 x < p 1 (1-(y/(1- p 1 ))).
I would like to plot the following inequalities: y < p2(1 - p1) and x < p1(1 - ( y / (1 - p1))).
鉴于第一个条件满足,我想绘制两个条件都满足的区域.
p 1 和 p 2 可以在[0,1]之内变化.
Given that the first is satisfied, I want to plot the region in which both are satisfied.
p1 and p2 can vary within [0,1].
我将不胜感激!
推荐答案
尝试一下:红色区域是两个不等式都满足的地方.
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')
这篇关于如何绘制不平等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文