Solve Inequality with inequality constraints

3 ビュー (過去 30 日間)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020 年 7 月 10 日
コメント済み: Walter Roberson 2020 年 7 月 10 日
Hi there,
i am trying to "solve" an inequality (actually looking for the area of possibel solutions), I have tried this.
syms I I_opt
a=0.1735;
b=0.1967;
c=0.2137;
d=0.2856;
eq_1=I>=0;
eq_2=I_opt>=0;
eq_3=I<=4.67;
eq_4=I_opt<=4.67;
eq_5=a/c*exp(b*I-d*I_opt)*(1-a*exp(b*I))/(1-c*exp(d*I_opt))>1;
eqns=[eq_1 eq_2 eq_3 eq_4 eq_5];
S=solve(eqns,[I I_opt])
Which is actually inequality 5, with 0<=I,I_opt<=4,67;
I get a struct with zero size, although it seems there are solutions for the equations, do you know why?
thanks!!
  3 件のコメント
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020 年 7 月 10 日
編集済み: Nikolas Spiliopoulos 2020 年 7 月 10 日
sure
that's what I get in matlab
I 0 X sym
I_opt 0 X sym
a possible solution is:
I=4.4
I_opt=2
Walter Roberson
Walter Roberson 2020 年 7 月 10 日
Two disconnected triangles. They both fit inside I = 0 to 4.67, I_opt = 0 to 4.67 (

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 7 月 10 日
There is no symbolic solution; the equations are too complicated for that.
syms I I_opt real
Q = @(v) sym(v);
a = Q(0.1735);
b = Q(0.1967);
c = Q(0.2137);
d = Q(0.2856);
eq_1 = I >= Q(0);
eq_2 = I_opt >= Q(0);
eq_3 = I <= Q(4.67);
eq_4 = I_opt <= Q(4.67);
eq_5 = a/c*exp(b*I-d*I_opt)*(1-a*exp(b*I))/(1-c*exp(d*I_opt)) > Q(1);
eqns = [eq_1, eq_2, eq_3, eq_4, eq_5];
S = solve(eqns,[I I_opt], 'returnconditions', true);
disp(S)
[Ig, IoG] = ndgrid(linspace(0,4.7,200));
EQ1 = double(subs(eq_1,{I,I_opt},{Ig, IoG}));
EQ2 = double(subs(eq_2,{I,I_opt},{Ig, IoG}));
EQ3 = double(subs(eq_3,{I,I_opt},{Ig, IoG}));
EQ4 = double(subs(eq_4,{I,I_opt},{Ig, IoG}));
EQ5 = double(subs(eq_5,{I,I_opt},{Ig, IoG}));
mask = EQ1 & EQ2 & EQ3 & EQ4 & EQ5;
surf(Ig, IoG, 0+mask, 'edgecolor','none')
  5 件のコメント
Walter Roberson
Walter Roberson 2020 年 7 月 10 日
btw, is there any way to see the actual values on z axis instead of just 0 and 1?
Only if by "actual values" you mean something like the total of the masks, like
mask = EQ1 + EQ2 + EQ3 + EQ4 + EQ5;
Remember, you do not define a surface, you define a number of inequalities, and each of them is only either true or false.
Walter Roberson
Walter Roberson 2020 年 7 月 10 日
syms I I_opt real
Q = @(v) sym(v);
a = Q(0.1735);
b = Q(0.1967);
c = Q(0.2137);
d = Q(0.2856);
eq_1 = I >= Q(0);
eq_2 = I_opt >= Q(0);
eq_3 = I <= Q(4.67);
eq_4 = I_opt <= Q(4.67);
eq_5_L = a/c*exp(b*I-d*I_opt)*(1-a*exp(b*I))/(1-c*exp(d*I_opt));
eq_5 = eq_5_L > Q(1);
%eqns = [eq_1, eq_2, eq_3, eq_4, eq_5];
%S = solve(eqns,[I I_opt], 'returnconditions', true);
%disp(S)
[Ig, IoG] = ndgrid(linspace(0,4.7,200));
EQ1 = double(subs(eq_1,{I,I_opt},{Ig, IoG}));
EQ2 = double(subs(eq_2,{I,I_opt},{Ig, IoG}));
EQ3 = double(subs(eq_3,{I,I_opt},{Ig, IoG}));
EQ4 = double(subs(eq_4,{I,I_opt},{Ig, IoG}));
EQ5_L = double(subs(eq_5_L,{I,I_opt},{Ig, IoG}));
EQ5 = EQ5_L > 1;
mask = EQ1 & EQ2 & EQ3 & EQ4 & EQ5;
z = nan(size(EQ5_L));
z(mask) = EQ5_L(mask);
surf(Ig, IoG, z, 'edgecolor','none')

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by