Find two contours at different levels around the same peak
Afficher commentaires plus anciens
Hi.
I would like to find two contours at different levels around the same lower peak and only keep those where this is true. I also want to reference two contours at different heights to each other. I assume the contour function is kind of random.
Let's say I have two different thresholds for two different levels. How can I find all the contours for threshold2 where also contours for threshold1 exist.
Threshold1 is lower than threshold2.
In the code example below I would only be interested in the two contours around the lower peak and I want to disregard or reject the other contour where no threshold1 contour exists.
In the example I only have two lower peaks but If I have many more lower peaks I would like to reference the contours to each other so that I know which contour at threshold2 is drawn around the same lower peak as for threshold1.
[X,Y,Z] = peaks(1000);
figure(1),hold on
view(2);
colorbar('vert');
s = surf(X,Y,Z,'Facealpha',0.75,'Edgecolor','none');
% threshold = -0.3*max(Z,[],'all');
threshold1 = [-6, -6];
threshold2 = [-3, -3];
[c1,h1] = contour(X,Y,Z,[threshold1 threshold1],'-k','Linewidth',5);
[c2,h2] = contour(X,Y,Z,[threshold2 threshold2],'-k','Linewidth',5);
hold off

Thanks.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Contour Plots dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!