MATLAB: How to solve a linear system with a maximum function

#maxfunction

just i want to know how we solve this system:
x+y = 1
max(x,y)=2
i tried this code but an error always appear:
syms x y
solve(x+y ==1,max(x,y)==2)
//Error using sym/max (line 97)
Input arguments must be convertible to floating-point numbers
any help ?

Best Answer

syms x y
[solx, soly] = solve([x+y==1,piecewise(x>y,x,y)==2],[x y])
Best wishes
Torsten.
Related Question