function R = LeveMarq(F,GF,HF,x0,tol,kmax) % % Levenberg-Marquardt Algorihtm for computing a % local minimum of a function of several variables: % % input data : % % F : handle to the function implementing the % objective function % GF : handle to the function implementing % the gradient of the objective function % HF : handle to the function implementing % the Hessian matrix of the objective % x0 : column vector – initial approximation % tol: relative tolerance % kmax: max number of iterations % % output data : % % R : Solution % xcurr = x0; % inizialize xprev xprev = 10*x0*tol; k=1; B = -GF(xprev); while(norm(xprev-xcurr)/norm(xprev)>=tol+eps && norm(B)>=tol+eps && k