A search on how to fill the area under a curve reveals that such questions are quite often asked. Here is the solution in a function file that I created for simplifying filled curve plots using matlabs fill function.
function handle = filledcurve(x, y, zero, colorspec) if (nargin < 3) zero = 0; end if (nargin < 4) colorspec = 'b'; end xtemp = [x(1) ; x(:) ; x(end)] ; ytemp = [zero ; y(:) ; zero ] ; % plot handle = fill(xtemp,ytemp,colorspec); |