title: Contour plot in MATLAB with constraints
body: <p>I'm completely new to MATLAB and have some problems.</p>
  
  <p>I need to make a contour plot of the following nonlinear optimization problem:</p>
  
  <p><a href="https://i.stack.imgur.com/qz8zW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qz8zW.png" alt="enter image description here"></a></p>
  
  <p>In order to determine the feasible region for the function. I've tried searching on <a href="http://se.mathworks.com" rel="nofollow noreferrer">Mathworks</a>, but haven't had any luck so far. I also have the following example:</p>
  
  <pre><code>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);
  
  colorbar
  yc1 = (x+2).^2;
  yc2 = (4*x)/10;
  
  hold on
  fill(x,yc1,[0.7 0.7 0.7],'facealpha',0.2)
  fill([x x(end) x(1)],[yc2 -5 -5],[0.7 0.7 0.7],'facealpha',0.2)
  hold off
  </code></pre>
  
  <p>But this is not shown the way it should either (it is suppose to look like this):</p>
  
  <p><a href="https://i.stack.imgur.com/BUT7I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BUT7I.png" alt="enter image description here"></a></p>