function [xnew,gradnew,alpha,p] = steepdesc(searchmtd,fnhess,fngrad,fn,gradold,xold) % description: does a single step of steepest descent. Returns % new x value, its gradient, step length and direction. % Input paramters: % searchmtd: line search method % fnhess: function hessian name % fngrad: function grad name % fn: function name % gradold: gradient at starting point % xold: starting point % global variables: global parms; % local variables: % xnew: new x value % gradnew: gradf(xnew) % alpha: step length used % p: descent direction used p = -gradold; alpha = feval(searchmtd,fngrad,fn,xold,p); xnew = xold + alpha*p; gradnew = feval(fngrad,xnew);