How to fill the area between contour line and upper bound.
조회 수: 3 (최근 30일)
이전 댓글 표시
How could I shade the area between the contour line and given upper bounds. The code is attached.
clc;
a=2*log(9);
func1 =@(x,W) 1./(1+exp(-a.*(x+log(2))./W)); % function phi-
func2 =@(x,W) 2./(1+exp(-a.*(x)./W)); % function phi-
func3 =@(x,W) (1./(1+exp(-a.*(x)./W))).^2; % function phi-
%-------------
func4 =@(x,W) (1./(1+exp(a.*(x+log(2))./W))); % function phi-
func5 =@(x,W) 1./(1+exp(a.*(x)./W)).^2; % function phi-
%------------------
W1d=2.^[-3.2:0.5:3.2]; % grid points along horizontal direction of plotting
x1d=[-5:0.1:5]; % grid points along vertical direction of plotting
[W,x]=meshgrid(W1d,x1d); % 2D grid points
z=0*x;
im=(x<0);
z(im)=func1(x(im),W(im))-func2(x(im),W(im))+func3(x(im),W(im));
ip=(x>=0);
z(ip)=-func4(x(ip),W(ip))+func5(x(ip),W(ip));
%-----------------
figure();
ind=(z<0);
semilogx(W(ind),x(ind),'.')
hold on
[C,h]=contour(W,x,z,[0 ,0],'k')
h.LineWidth = 3
clabel (C, h);
set(gca,'xtick',2.^[-3:3])
set(gca,'fontsize',14)
댓글 수: 0
답변 (1개)
KSSV
2020년 3월 27일
Get your required curve/ line coordinates; form a closed polygon and use patch/ area.
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!