How to use a contour between two curves?
2 views (last 30 days)
I have a nozzle profile and I wish to colour the nozzle using contours. But my colouring appears outside the nozzle area.
now, I have a 1D temperature array(1 x n) that I wish to express between the two curves as shown below
axis([0 3 0 6]);
DGM on 10 Apr 2022
Edited: DGM on 10 Apr 2022
You can use a patch object, but you'll have to specify the colormapping. This should be fairly straightforward, as your vertices are uniformly spaced along x.
% the inputs
x = linspace(0,3,31);
y1 = 1 + 2.2*(x-1.5).^2;
y2 = -y1;
T = -cos(x/3*pi); % some arbitrary temp data
% plot a patch
patch([x fliplr(x)],[y2 fliplr(y1)],[T fliplr(T)]);
% plot curves last
axis([0 3 -6 6]);
% add a colorbar
hcb = colorbar;
In this case, T is being used essentially as color data. The relative values in T (with respect to the extrema of T) correspond to the position within the colormap.