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]);
hold on
Kindly help.

Accepted Answer

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)]);
hold on
% 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.

More Answers (1)

Image Analyst
Image Analyst on 10 Apr 2022
Image Analyst
Image Analyst on 10 Apr 2022
Let's see your code where you attempted to implement the FAQ method. You forgot to attach it for some reason.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!