Turn inequalities into equalities
Mostrar comentarios más antiguos
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?
Respuestas (1)
Azzi Abdelmalek
el 15 de Jul. de 2015
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)
Categorías
Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!