function R = SteepestDescent2(F,GF,x0,alphak, tol,kmax) % Minimization of a function of several variables: Steepest Descent. % version with constant step (learning rate) alphak. % input : % % F : handle to the objective function % GF : handle to the gradient of the objective function % x0 : column vector – initial approximation of the solution % alphak: constant step (learning rate) % tol: tolerance % kmax: maximum number of iterations % % output : % % R : Matrix of the sequence of approximated % solutions (by columns) % xcurr = x0; R = x0; % initialize xprec xprev = 10*x0*tol; k=1; B = -GF(xprev); while(norm(xprev-xcurr)/norm(xprev)>=tol+eps && norm(B)>=tol+eps && k