How to fill the area between contour line and upper bound.

3 ビュー (過去 30 日間)
Maryam Adamzadeh
Maryam Adamzadeh 2020 年 3 月 27 日
コメント済み: Maryam Adamzadeh 2020 年 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)

回答 (1 件)

KSSV
KSSV 2020 年 3 月 27 日
Get your required curve/ line coordinates; form a closed polygon and use patch/ area.
  3 件のコメント
KSSV
KSSV 2020 年 3 月 27 日
From countour you can get.
Maryam Adamzadeh
Maryam Adamzadeh 2020 年 3 月 30 日
Accepted. Thank you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by