function [x Iter]=con_grad(f,g,x,epsi)
sigma=3/4;
d=-g(x);
Iter=0;
dn=norm(d);
while dn>=epsi
    t=LineSearch(f,g(x),x,d,sigma);
    x=x+t*d;
    d1=-g(x);
    d11=norm(d1);
    beta=(d11/dn)^2;
    d=beta*d+d1;
    dn=d11;
    Iter=Iter+1;
   
end
end

function [t]=LineSearch(f,g,x,d,sigma)
        j=0;
        f1=f(x);
        f2=sigma*d'*g;
        t=1;
        while f(x+t*d)> f1+t*f2
        t=(1/2)^(j)*t;
        j=j+1;
        end
end
        
        
       
