% AF-I seminar implied volatility by newton method
clear all;
k=0;
eps=0.0000001;
x=0.5; %initial guess
xprev=0.9; % auxiliary initial value
%disp('iter x error')

while abs(x-xprev)>eps
    xprev=x;
    x=x-feval(@f,x)/feval(@fprimeVega,x);
    k=k+1;
  
end
fprintf('\n %2d % 12.5f ',k,x)