how to plot inequality and their intersection ?
조회 수: 9 (최근 30일)
이전 댓글 표시
Hi.
I want to plot these inequalities.
x+y>=4
8*x-4*y>=-16
x>=2
y<=9
how can I plot them (the lines where they bind) and the area which they contain? I want to find a solution with the intersection of those areas later.
I want to have something like this. with stripped areas representing the inequality areas, which can be colored in matlab.
Thank you so much
댓글 수: 0
답변 (1개)
Matt J
2021년 10월 14일
편집: Matt J
2021년 10월 14일
The region prescribed by your inequalities is unbounded, so it is not clear what it means to "plot" it. If you really meant x<=2, then the region will be bounded and you can use lcon2vert (Download) as follows,
A=[-1 -1; %inequalities in matrix/vector form
-8 4;
1 0;
0 +1];
b=[-4;16;2;9];
plot( polyshape(lcon2vert(A,b)))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!