Fill the areas between two curves that cross at multiple pts, with different colors under each curve
Updated 10 Mar 2015

View License

This function fills the areas between two curves that intersect at multiple
points. The area where curve 1 > curve 2 is filled in one color, and the
area where curve 2 > curve 1 is filled in another color.
It performs piecewise interpolation so that the area is completely filled, even if the intersections are between defined points.

Cite As

William Hobbs (2024). gtfill(x,y1,y2,n,c1,c2) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Curve Fitting Toolbox in Help Center and MATLAB Answers

Inspired by: Shade area between two curves

Inspired: anomaly, fill_between

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Updated to try to fix errors pointed out by Thijs and Masao Ashtine.

Changed title.