Matlab Code Write a Matlab code for the Simplex method for l

[Matlab Code]

Write a Matlab code for the Simplex method for linear programming

subject to

Solution

% look at linprog in matlab if you have further confusion

% creating a coefficient matrix

A = [2 1 1
    -1 2 -1
    1 5 5];

%creating vector for resultant values
b = [15 7 25];

%optimization function
f = [1 2 -7];

%lower bound for each variable
lb = [0,0,0];

%setting to use simplex method
options = optimoptions(\'linprog\',\'Algorithm\',\'dual-simplex\');

%method used linprog given by matlab.

%linprog(optimization function, coefficient matrix, resultant vector, constraint matrix, constraint %vector, lower bound, upper bound, some initial value, options parameter that passes in \'simplex %method\' flag)
[x,fval,exitflag,output] = linprog(f, A, b, [], [], lb, [], 10.000, options);
disp(x);
disp(fval);
disp(output);

[Matlab Code] Write a Matlab code for the Simplex method for linear programming subject toSolution% look at linprog in matlab if you have further confusion % cr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site