Solve set of inequalities
Ältere Kommentare anzeigen
Hello!
I want to solve set of inequalities. One of real number solution will be good enough for me.
Earlier I used MathCad for that. I am new to Matlab. I wrote code below, but it didn't work. Ideally I need same solution as I get in MathCad (not exactly but close).
A = -203;
B = 12189;
DAC05 = 206;
DAC45 = 1864;
gamma = 2;
syms C0 C1
eqn1 = 2048*((A+C0)/C1)>=DAC05-gamma;
eqn2 = 2048*((A+C0)/C1)<=DAC05+gamma;
eqn3 = 2048*((B+C0)/C1)>=DAC45-gamma;
eqn4 = 2048*((B+C0)/C1)<=DAC45+gamma;
eqns = [eqn1, eqn2, eqn3, eqn4];
S = vpasolve(eqns,[C0 C1]);
S.C0;
S.C1;

Can anyone help me with that?
Akzeptierte Antwort
Weitere Antworten (2)
Here is what i invented
clc,clear
cla
A = -203;
B = 12189;
DAC05 = 206;
DAC45 = 1864;
gamma = 2;
c0 = linspace(-1e3,1e3,30)+1700;
c1 = linspace(-1e4,1e4,30)+15270;
[C0,C1] = meshgrid(c0,c1);
FA = 2048*(A+C0)./C1;
FB = 2048*(B+C0)./C1;
% eqn1 = FA >= DAC05-gamma;
% eqn2 = FA <= DAC05+gamma;
% eqn3 = FB >= DAC45-gamma;
% eqn4 = FB <= DAC45+gamma;
% ix = eqn1 & eqn2 & eqn3 & eqn4;
contour3(C0,C1,FA,[-1 1]*gamma+DAC05,'b')
hold on
contour3(C0,C1,FB,[-1 1]*gamma+DAC45,'r')
surface(C0,C1,FA,'facecolor','r','edgecolor','none')
surface(C0,C1,FB,'facecolor','b','edgecolor','none')
hold off
axis vis3d
alpha(0.3)
xlabel('C0')
ylabel('C1')
Results

I belive there is more simple solution. Anybody has other ideas?
2 Kommentare
Dmitry Medvedev
am 19 Apr. 2020
darova
am 19 Apr. 2020
Maybe this
syms C0 C1 FA FB
eq1 = FA - 2048*(A+C0)./C1;
eq2 = FB - 2048*(B+C0)./C1;
res = solve([eq1 eq2],C0,C1);
res.C0
res.C1
wher
FA = DAC05+[-gamma .. +gamma]
FB = DAC45+[-gamma .. +gamma]
Dmitry Medvedev
am 19 Apr. 2020
0 Stimmen
Kategorien
Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

