How to plot contour with constraints

1 回表示 (過去 30 日間)
Aiden James
Aiden James 2020 年 9 月 16 日
コメント済み: Aiden James 2020 年 10 月 4 日
% I have following equations. I want to see variation of cp(si1,si2) with si1 and si2 with following constraints
% constraints are , gamma> max(0 -alpha) and gamma+ beta < 0
% I have written following code, but is giving wrong results. Code is giving value of cp in the range of 0 to 140 but it should around 0 to 2.5
% I have attached the for expected output. But I am getting completely wrong result.
clear all
Cpe=-0.6
lamdan=0.5
lamdad=0.5952
lamda12=0.84
nd=0.9
n12=0.9
nn=0.7
alpha= nn+lamdan^2*(1-nn)-n12*(1-lamda12^2)-nd*lamda12^2*(1-lamdad^2)
beta= alpha+ ((lamdad^2*lamda12^2*(1-Cpe))/Cpe)
[si1 si2] = meshgrid(0:0.1:1, 0:0.1:1);
gamma=si1+(si2*lamda12^2)
cp= gamma*((1-Cpe)./(gamma+alpha)).^1.5
keepind = gamma+ beta > 0
si1(keepind) = NaN
si2(keepind) = NaN
contourf(si1, si2, cp)
  3 件のコメント
Aiden James
Aiden James 2020 年 9 月 16 日
Sorry , range for si1 and si2 is 0 to 1
0 < si1 < 1
0< si2 <1
Aiden James
Aiden James 2020 年 9 月 16 日
I want to see variation of cp within the above range of si1 and si2

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

採用された回答

KSSV
KSSV 2020 年 9 月 16 日
Cpe=-0.6;
lamdan=0.5;
lamdad=0.5952;
lamda12=0.84;
nd=0.9;
n12=0.9;
nn=0.7;
si1 = linspace(0,1) ;
si2 = linspace(0,1) ;
[si1,si2] = meshgrid(si1,si2) ;
alpha= nn+lamdan.^2*(1-nn)-n12*(1-lamda12.^2)-nd*lamda12.^2*(1-lamdad.^2) ;
beta= alpha+ ((lamdad.^2*lamda12.^2*(1-Cpe))./Cpe) ;
gamma=si1+si2*lamda12.^2+alpha ;
cp= (si1+si2*lamda12.^2)*((1-Cpe)./(si1+si2*lamda12.^2+alpha)).^1.5 ;
contour(si1,si2,cp)
  4 件のコメント
KSSV
KSSV 2020 年 9 月 16 日
But you are not using gamma and beta in cp.
Aiden James
Aiden James 2020 年 10 月 4 日
gamma and beta are the functions of si1 and si2. Sir, my problem is solved. Your help is greatly appreciated. Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGamma Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by