Info

This question is closed. Reopen it to edit or answer.

How to fill area between contour line and upper bound

1 view (last 30 days)
How to fill area between the contour line and the upper bound? 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));
%-----------------
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)

Answers (0)

Community Treasure Hunt

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

Start Hunting!