clear; close all; clc;

xk1 = 5;
err = 0.0001;
xk  = 10*xk1/(1+err);
k   = 1;
K   = 20;
delta = 10*eps;
while (abs((xk1-xk)/xk)  >= err) && (k < K)
    xk  = xk1;
    fx  = optim_fcn(xk);
    dfx = (optim_fcn(xk+delta) - optim_fcn(xk - delta))/(2*delta);
    xk1 = xk - fx/dfx;
    disp([k xk1 fx]);
    k = k + 1;
end