How to fill the area between contour line and upper bound.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen

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 Kommentare
Antworten (1)
KSSV
am 27 Mär. 2020
Get your required curve/ line coordinates; form a closed polygon and use patch/ area.
3 Kommentare
Siehe auch
Kategorien
Mehr zu Contour Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!