Question

I'm beginner at matlab, and I'm interested how to find the solution of equation :

2x + y  <=  6
4x + 5y <=  20
x + 2y  >=  4
5x + 3y  <=  15
x - 2y + 6  <=  0

how to graph this equation in matlab? Thanks in advance

Was it helpful?

Solution

In response to some of the comments, I want to say that it does make sense to have these 5 equations in 2 unknowns. First of all, these are inequalities, not equalities. Each of them represent half side of the 2D plane after being cut by a line (all different lines). And your solution to this system of inequality is just the area that is intersection of all these half planes. It could be a closed polygon region, or an unbounded region, or empty set.

Since this looks like an assignment question, I'm not gonna given you the solution here. But here's a hint, densely sample points from XY plane, and for each point, if it satisfies all the equations, plot it, otherwise don't ...

P.S. even if there are all equalities, the system of more linear equations than variables still make sense. It's an overdetermined system, and there is solution in the "least square" sense, i.e. line fit to lots of noisy data with the lowest sum of squared error. But this is not your scenario.

OTHER TIPS

This can be solved by a simplex (optimization method, linear programming) which is totally deterministic hence a computer can achieve the job. Matlab provide tools for this such as linprog. Inequations are your constraints and will define a convex polytope which can be bounded, unbounded or empty. And your goal function is equals to 1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top