Vector ranking and transformation matrix
Show older comments
Hello. Suppose we have a vector [1 4 3], here -x1+x2>0, -x1+x3>0 and also x2-x3>0. How can we transform this ranking information into a matrix like [-1 1 0; -1 0 1; 0 1 -1]? Is there a function to realize it? Thank you in advance for your time and help.
2 Comments
Stalin Samuel
on 21 Sep 2016
- Once you evaluate the below details you get the answer
- What is the values of x1,x2,x3 ?
- How do you relate the given vector with ranking information?
- What is the logic behind the final matrix?
Xia
on 21 Sep 2016
Accepted Answer
More Answers (1)
Steven Lord
on 21 Sep 2016
0 votes
If you're asking how to convert the inequalities (like -x1 + x2 < 0) into matrix form, I don't know if there's a function to do exactly that but the equationsToMatrix function comes close. You may be able to slightly modify your inequalities so they are equations then use equationsToMatrix to generate the matrices to use as your A, b, Aeq, and beq inputs to the Optimization Toolbox solvers (which is how I'm assuming you're planning to use those matrices.)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!