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?

Answers (1)

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)

Categories

Asked:

C N
on 15 Jul 2015

Answered:

on 15 Jul 2015

Community Treasure Hunt

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

Start Hunting!