MATLAB: How to fill a colour in the area surrounded by lines, X &Yaxis and a curve

colourcurvefillplot

Best Answer

x = [0 50 50] ;
y = [100 100 150] ;
%%Add cooridnates for closing the given points in anti clockwise direction
xi = [50 150 150 0 0] ;
yi = [150 150 0 0 100] ;
xx = [x xi] ;
yy = [y yi] ;
plot(xx,yy)
patch(xx,yy,'r')