Adding feasible region on a Contour plot
이전 댓글 표시
Hi,
I am trying to plot a contour of an optimization problem and also determine the feasible region for the function.
I have been able to generate the contout plot but I I don't know how to plot the feasible region when the constraint is X > 0.
Example of my code is shown below.
Assuming the constraints is given by:
Thank you for your help
x = -5:0.005:5;
y = -5:0.005:5;
[X,Y] = meshgrid(x,y);
F = (X.^2+Y-11).^2 + (X + Y.^2 - 7).^2;
v = [0:2:10 10:10:100 100:20:200]
[c,h]=contour(X,Y,F,v,'linewidth',2);
댓글 수: 2
DGM
2021년 4월 10일
It depends how you want to represent it. Do you want the whole plot from -5:5 with some sort of lines or mask to delineate the feasible region, or do you just want to plot the feasibile region alone?
Telema Harry
2021년 4월 10일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



