ff = [-100 -150 -200 -400]; % vector to define the objective function aa = [10 12 25 20; 2 4 8 12; -1 0 0 0; 0 -1 0 0; 0 0 -1 0; 0 0 0 -1]; % matrix to define constraints % (left hand side) bb = [500 150 0 0 0 0]; % matrix to define right hand side of constraints [x,fval,exv,out,lam] = linprog(ff,aa,bb) % % to see the Lagrange multipliers, look at the vectors lam.ineqlin or lam.eq % look at matlab online help: "help linprog" for more details %