title: Formatting equations for linprog in MATLAB
body: <p>I have to solve a simple problem using function <code>linprog</code> in matlab math toolbox. The problem is that I don't know how to format my equations so this function solves the problem.</p>
  
  <p>This is the function I am trying to minimize (<code>a_i</code> are some given coefficients, <code>x</code> is in R^5): </p>
  
  <pre><code>x = argmax min{a1*x1 + a2*x2, a2*x2 + a3*x3 + a4*x4, a4*x4 + a5*x5}
  </code></pre>
  
  <p>subject to:</p>
  
  <pre><code>sum(x_i) = 3000
  all x_i &gt;= 0
  </code></pre>
  
  <p>This could be rephrased as:</p>
  
  <pre><code>(x, lambda) = argmin(-lambda)
  </code></pre>
  
  <p>subject to:</p>
  
  <pre><code>a1*x1 + a2*x2 &gt;= lambda
  a2*x2 + a3*x3 + a4*x4 &gt;= lambda
  a4*x4 + a5*x5 &gt;= lambda
  sum(x_i) = 3000
  all x_i &gt;= 0
  </code></pre>
  
  <p>I could only find examples of minimization of simple linear functions without min/max arguments in it. Could you give me a hint how to make my structures as arguments for <code>linprog</code> function?</p>