Turn inequalities into equalities

This must be done symbolically, so I am considering other languages.
Given a set/list/array of inequalities- {2x >= y, 2z >= y, 2x+y <= 4, 2z+y <= 4}
I would like to be able to set certain equations equal. In this example, lets set equations 1 and 3 equal generating-
2x=y & 2x+y=4.
How can I assign the coefficients in the inital list to a matrix?

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 15 Jul. 2015

0 Stimmen

syms x y z
eq={2*x >= y, 2*z >= y, 2*x+y <= 4, 2*z+y <= 4}
out=cellfun(@(x) sym(regexprep(char(x),'<=|>=|<|>','=')),eq([1 3]),'un',0)
celldisp(out)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

C N
am 15 Jul. 2015

Beantwortet:

am 15 Jul. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by