nav-left cat-right
cat-right
Matthias Pospiech > Programming > matlab > plotting a filled curve

plotting a filled curve

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);

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *


*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP-SpamFree by Pole Position Marketing