Fill the region between two lines
1,064 views (last 30 days)
I plot two functions and then I want to fill the region between them in red (for example).
Could you please suggest me the function to do this?
Star Strider on 5 Feb 2019
Use the patch (link) function:
patch([x fliplr(x)], [y1 fliplr(y2)], 'g')
To use it, create a closed area (the reason for the fliplr calls, since they create the closed area), and choose the color.