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?

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 15일

0 개 추천

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)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

C N
2015년 7월 15일

답변:

2015년 7월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by