How to plot the area between the 2 curves with transparency 50% ?
조회 수: 7 (최근 30일)
이전 댓글 표시
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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/892955/image.jpeg)
댓글 수: 0
채택된 답변
Star Strider
2022년 2월 13일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!