% m24ranbig.m - bigger linear programming example, random constraints % Define the problem: f = [1; 2]; % objective function A = randn(400,2); b = ones(400,1); % alternative choice of constraints % Plot the problem: hold off [m,n] = size(A); xx = [-2 2]; for j = 1:m yy = (b(j)-A(j,1)*xx)/A(j,2); plot(xx,yy), hold on end axis(1.3*[-1 1 -1 1]), axis square, shg, pause % Solve the problem and plot the result: X = linprog(f,A,b); plot(X(1),X(2),'.-r','markersize',35)