I have a function that is piecewise defined that I would like to fill the area to the right of. Here is what I have so far:
x0=[-10:0.01:10];t=(-1./abs(x0));figure; plot(t,x0)grid onxlim([-10 10])ylim([-10 10])hold on% Now shade the Omega region
grayColor = [0.9 0.9 0.9];h1 = patch([0 0 10 10],[min(ylim) max(ylim) max(ylim) min(ylim)],grayColor);set(h1,'EdgeColor','none');
I can only get a rectangle to the right of the plot to fill. When I try to fill the area between the top and bottom part of the function, the result is a blank fill area.
h2 = patch(t,x0,grayColor);set(h2,'EdgeColor','none');
Any ideas?
Best Answer