How can I fill the area bewteen two curves with a colormap?

5 views (last 30 days)
I have a region restricted between two curves. First I was asked to color the area in the region, which I did with
T=linspace(0,15.7510);
y1=me*(exp(k*T)-1);
y2=MS*(1-exp(-k*T));
x=T;
fill([x fliplr(x)], [y2 fliplr(y1)], 'c', 'EdgeColor','none');
However now there is a new variable and a new restriction, and I need to include this in the form of a colormap in the shaded region that goes from me*exp(-kT) to MS.
Basically, I want to colour in the region with a colormap that depends on another variable restricted between me*exp(-kT) and MS.

Answers (1)

Walter Roberson
Walter Roberson on 19 Nov 2015
fill() creates a patch() object. You can color patch() objects by setting a CData property for their faces (effectively a texture map), or you can set a solid face color. Alternately you can set color data for each vertex of the patch and then configure one of the ways to determine the color of a section based upon its vertices. The two major ways to configure the color based upon vertices are "color is constant for the section and determined by the color of the first vertex in the face list", or "color is determined by interpolation".
For more information, please search for information on "patch properties"

Categories

Find more on Colormaps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!