Solve linear system by trial and error

I need to solve an equation like x=a+b; putting a condition such that x>b. How can i do that in matlab ?

 Accepted Answer

madhan ravi
madhan ravi on 9 Sep 2018
Edited: madhan ravi on 9 Sep 2018
Try this:
syms x a b
assume(x>b)
eqn=x==a+b
sol=solve(eqn,x,'ReturnConditions',true)
sol.x

4 Comments

Thanks for your reply. If a=100; b=[1;2;3]; equation is: x=a+sum(b); I am looking for a solution that will satisfy x>b (i.e, x will be greater than any member of b.
syms x
a=100
b=[1;2;3]
assume(x>b)
eqn=x==a+sum(b)
sol=solve(eqn,x,'ReturnConditions',true)
sol.x
madhan ravi
madhan ravi on 9 Sep 2018
Edited: madhan ravi on 9 Sep 2018
This will display the solution if and only if x greater than any member of b.
@carl did it satisfy?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!