Engineering
Engineering, 24.10.2019 01:50, aaroneduke4576

Problem 2: write a matlab function that implements the simplex method. the first line of your .m file should read as follows: function [xsol, optimalobjective, basisfinal]=simplextwoyourname(a, b,c) and it should solve linear programs of the form min c t x s. t. ax = b, x ≥ 0 via simplex method, finding a starting basis with first phase of the two phase method and then solving the problem of interest with the second phase. your matlab function should output the optimal solution, the optimal objective function value, and the final basis that corresponds to the optimal basic feasible solution

answer
Answers: 3

Similar questions

Предмет
Mathematics, 14.11.2019 05:31, ugtguytu8528
We want to write a matlab function to solve the non-linear equation f(x) = 0 using any of the methods we learned in section-4. let's define our function as: (xsol, nit, error] = nonlin_lastname(solver,f, a,b, tol,nmax). the first input, solver, is an integer between 1 and 4 which will determine which method should be used, i.e. bisection method if solver=1; regula falsi method if solver=2; newton's method if solver=3; secant method if solver-4. the next input f is an anonymous function. the initial guess values are input by a and b: for the bracketing methods, a and b are the bounding points; for newton's method, a is the initial guess and b should be ignored (but still needs to be used when calling the function); and for the secant method, a and b are initial solution guesses. for bracketing methods, if the initial interval does not bracket a solution, your functions should return with an error message. the convergence tolerance and the maximum number of iterations are input by tol and nmax, respectively. for the newton's method, use the procedure in problem 2.b for estimating the derivative. the function has three outputs: the approximate numerical solution xsol, the integer nit which is the number of iterations it took for the solution to converge, and the error in your solution, i.e. f(x nit)=f(xsol). the iterations should stop if any of the following convergence criteria is met: i) ii) if(xn)] iii) n > nmax (or in other words we should do nmax iterations at most) optional: if you want to examine the trend of the iterations, you may have your function print all the information of the iteration results to the screen using: fprintf('n=%i: \tx%i = %e it f(x%i)=%e \n',n,n,x,n,f(x)); where n is the current iteration counter, x is the current approximation and f(x) is the function value at x. now write a script to test your function for different nonlinear equations given below with their specified initial guess values. use a tolerance of 10-11 and nmax = 1000. a. *4 = 3x2 + 2; a = -1.5; b = 10 b. 1 = (2x2 – 1.2)2(2(x – 2.5))*; a = 1.5; b = 2.5 c. tan (x)tan (x) = 1000; a = 1.2; b = 1.45 d. xe* = 10; a = -3; b = 3 e. [x]= 0.3; a = -1; b = 0 f. cos(x) = x; a = -1.579; b = 2 for each of the nonlinear equations, report your results in a separate table with the general format below and using four decimal digits. you may use 'format short; ' in your matlab script to automatically round the numbers to four decimal places. then for each nonlinear equation, plot the function f in the range [2a - b, 2b - a) and use the plots to explain the behavior of each method. method nit xsol error bisection regula falsi newton's secant
Answers: 2
Do you know the correct answer?
Problem 2: write a matlab function that implements the simplex method. the first line of your .m fi...

Questions in other subjects: