Professional Documents
Culture Documents
n = 0;
while n < N
fx = 2*x0+(2*x0+1)*exp(-2*x0);
fx1 = 2*x1+(2*x1+1)*exp(-2*x1);
x=x1-(fx1*(x1-x0)/(fx1-fx));
x0 = x1;
x1 = x;
errorx1 = abs(fx1);
n = n+1;
if abs(fx1) < toleransi ;
break
end
end
fprintf ('stop pada iterasi ke = %g,\n nilai minimum =%e,\n dengan error =%f\n', n,
x1, errorx1)