How to shade area between an upper bound and lower bound curve?

12 visualizaciones (últimos 30 días)
I have an upper bound curve comprised of vectors xmax, ymax. I also have a lower bound curve comprised of vectors xmin, ymin. The two curves do not connect to make a polygon but have the same number of elements. All four vectors are 1x361. How could I shade the area in between the curves given the upper and lower bounds? The .mat files for each vector are attached.

Respuesta aceptada

Star Strider
Star Strider el 18 de En. de 2018
It would help to have at least a sample of your data. Without it, a guess is the best I can do.
With the monotonically-increasing x-vector in the first row, and the y-vector in the second row for each matrix, use the patch (link) function:
v = rand(1, 361);
vs = sort(v);
UpperBound = [vs; v + 3];
LowerBound = [vs; v + 1];
figure(1)
patch([UpperBound(1,:) fliplr(LowerBound(1,:))], [UpperBound(2,:) fliplr(LowerBound(2,:))], [0.1 0.5 0.9], 'EdgeColor','none')
Note: The patch function will close the curve on its own.
  4 comentarios
Andrew Poissant
Andrew Poissant el 18 de En. de 2018
This is perfect, thank you for the help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by