How to plot the area between the 2 curves with transparency 50% ?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mustafa Sobhy
le 13 Fév 2022
Réponse apportée : Star Strider
le 13 Fév 2022
y = [0;2;4;8;12;15;19;21;23;26;29;32;36;40;43;45];
h=[-0.4270; -0.3210;-0.3600;-0.2967;-0.1400;-0.0876;-0.2430;-0.4170;-0.9860;-0.7460;-0.6430;-0.5470;-0.4300;-0.3210;-0.2500;-0.2890];
l=[-0.2200;-0.1060;-0.1150;-0.0640;0.0550;0.0870;-0.0309;-0.2110;-0.7630;-0.5440;-0.4410;-0.3650;-0.2290;-0.1160;-0.0590;-0.0946];
plot(y,h,'b');hold on;
plot(y,l,'b');

0 commentaires
Réponse acceptée
Star Strider
le 13 Fév 2022
y = [0;2;4;8;12;15;19;21;23;26;29;32;36;40;43;45];
h=[-0.4270; -0.3210;-0.3600;-0.2967;-0.1400;-0.0876;-0.2430;-0.4170;-0.9860;-0.7460;-0.6430;-0.5470;-0.4300;-0.3210;-0.2500;-0.2890];
l=[-0.2200;-0.1060;-0.1150;-0.0640;0.0550;0.0870;-0.0309;-0.2110;-0.7630;-0.5440;-0.4410;-0.3650;-0.2290;-0.1160;-0.0590;-0.0946];
figure
plot(y,h,'b')
hold on
plot(y,l,'b')
patch([y; flipud(y)], [h; flipud(l)], 'r', 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
The approach is to create a closed, continuous curve for patch to fill. That is the reason for the flip (here flipud) calls.
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polygons dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
