Try this:
x = linspace(-5, 5);
upgoing_curve = x.^2;
downgoing_curve = 5 - x.^2;
idx = (downgoing_curve > upgoing_curve) & (x >= 0);
figure(1)
plot(x, upgoing_curve, x, downgoing_curve, '-k');
hold on
patch([x(idx) fliplr(x(idx))], [upgoing_curve(idx) fliplr(downgoing_curve(idx))], 'g')
hold off
The patch call defines the independent variable and then flips it, and the dependent variables and flips the second one. The idea here is to create a closed curve, defined by ‘x(idx)’ and its ‘mirror image’, and the lower curve and the flipped version of the upper curve.
Best Answer