How to gray out part fo surf plane on MATLAB

90 Views Asked by At

The MATLAB code below is used to plot a plane and show constrain lines on the same plane. The constrained areas are as below:

  • Area below the cyan line
  • Area below green line
  • Area below blue line (sorry, not very visible)
  • Area above red line

enter image description here

What is the simplest way to shade off (grayed out or something similar) the constrained region? (as shown below)

enter image description here

clc
clear;
close all;

[X1,X2] = meshgrid(0:10:3000,0:10:6000);    
TEST = (33*X1 + 3*X2);                      
surf(X1,X2,TEST);   
hold on;                        

X2 = cell(4,1);             

X2{1,1} = 2*X1;           
X2{2,1} = 6000-2*X1;        
X2{3,1} = 9*X1;            
X2{4,1} = (X1*0)+1200;      

colour = cell(4,1);         

colour{1,1} = 'r';
colour{2,1} = 'g';
colour{3,1} = 'b';
colour{4,1} = 'c';

for i = 1:4
    TEST = (33*X1 + 3*X2{i,1});
    h=surf(X1,X2{i,1},TEST);
    set(h,'edgecolor',colour{i,1});
    set(h,'LineWidth',2)
    xlim([0 4000]);    
    ylim([0 7000]);   
    zlim([0 130000]);
    hold on;
end
0

There are 0 best solutions below