Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How do I solve the following system of linear inequalities?

Subject: How do I solve the following system of linear inequalities?

From: Loners Hicks

Date: 10 Feb, 2010 01:40:05

Message: 1 of 4

Let A=[1 -2 1 3 1;-1 1/2 -3 2 3;1 1 1 -3 -4;1 -3 2 2 4;-3 1 -2 1 2;3 0 -3 1 2]
and b=[0;0;0;0;0]
Ax >= b

How do I solve this in Matlab?
Please help me figure this out.

Thank you so much!

Subject: How do I solve the following system of linear inequalities?

From: Saurabh Mahapatra

Date: 16 Feb, 2010 17:09:21

Message: 2 of 4

Hi there,

One possibility is the use of singular value decomposition of your matrix itself. You could also possibly use QR decomposition as well. See my attempt at solving this problem. You would use this approach if you want a minimal set of hyperplanes to describe the final solution which becomes important if dimension of your space is large. However, for this problem-a brutal solution of Ax>=b symbolically should also suffice.

% cleanup
clear all;
clc;
reset(symengine);

% To solve Ax>=b
A=[1 -2 1 3 1;-1 1/2 -3 2 3;1 1 1 -3 -4;1 -3 2 2 4;-3 1 -2 1 2;3 0 -3 1 2];
% b should have the same dimension as the number of rows of A
b=[2;3;4;1;2;1];

% Find the SVD of the matrix A(mxn). U(mxm) and V will(nxn) be unitary
% matrices with S as (mxn) with values along the diagonal, 0s will trail.
[U,S,V]=svd(A);

% Declare some symbolic variables
syms x y x1 x2 x3 x4 x5 x6
x=sym('[x1;x2;x3;x4;x5]');

% Do some math
% Basic idea is (USV)x>=b, start moving terms to the right to get equations in x
b_dash=U\b;
for i=1:(size(S,2))
    if S(i,i)~=0
    % Points within the solution should satisfy the following equation >=0. To test if a given point is a solution, plug
    % that value into all equations to see if they all satisfy y>=0 and we
    % are done. To express the solution symbolically, use
    y(i,1)=V(i,:)*x-b_dash(i,1)/S(i,i);
    else
        break;
    end
 end

Please note that these set of equations would describe the solution in terms of the hyperplanes. Visualization of this may require some creativity(some dimensions of the hyperplanes or using projections) for this 6D space. However, determining if a point belongs to the solution set should be easy based on the solution above.

Thanks,

Saurabh

Subject: How do I solve the following system of linear inequalities?

From: l.s.irankhah@gmail.com

Date: 12 Aug, 2013 19:44:32

Message: 3 of 4

On Wednesday, February 10, 2010 5:10:05 AM UTC+3:30, Loners Hicks wrote:
> Let A=[1 -2 1 3 1;-1 1/2 -3 2 3;1 1 1 -3 -4;1 -3 2 2 4;-3 1 -2 1 2;3 0 -3 1 2] and b=[0;0;0;0;0]Ax >= bHow do I solve this in Matlab? Please help me figure this out.Thank you so much!

hello
I want to solve a system of linear inequalities in MATLAB,
for example my variables are : f1,f2,f3,f4
one condition is f1+f2+f3+f4=5,I dont have an optimal(min or max)function.I want to find all feasible answers for f1,f2,f3,f4.
please help me.I need it.help!!!!!!!!!!!!!!!!!!
with best rigards.

Subject: How do I solve the following system of linear inequalities?

From: Roger Stafford

Date: 12 Aug, 2013 20:22:11

Message: 4 of 4

"Loners Hicks" <hick1416@bellsouth.net> wrote in message <hkt2pl$db3$1@fred.mathworks.com>...
> Let A=[1 -2 1 3 1;-1 1/2 -3 2 3;1 1 1 -3 -4;1 -3 2 2 4;-3 1 -2 1 2;3 0 -3 1 2]
> and b=[0;0;0;0;0]
> Ax >= b
>
> How do I solve this in Matlab?
- - - - - - - -
  If you suppose for a moment that your A matrix is 2 x 2 instead of 5 x 5, the set of points satisfying your condition A*x >= b would be an infinite wedge-shaped region lying to one side of each of two lines in the x-y plane. Such a region would of course have infinitely many points in it. What would it mean to "solve" such a problem? The same question can be asked in the 5 x 5 case. What would you expect to see in a "solution"?

  Now if you were to require that A*x = b, that would be a different proposition for which the word 'solve' would be appropriate.

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us