function dy=derivace(x,y) % DERIVACE - numerical derivative (with central di?erence) function given by tablet % 
% x ... vector of independetn variable
% y ... vector of function values
% dy ... vector of approximated values of derivatives at [xi,yi]   
N = length(x); 
h = (x(2)-x(1)); % increment 
dy = y; dy(1) = (-3*y(1)+4*y(2)-y(3))/(2*h); % initial derivative 
for i=2:N-1 dy(i) = (y(i+1)-y(i-1))/(2*h); % further derivatives 
end
dy(N) = (y(N-2)-4*y(N-1)+3*y(N))/(2*h); 
end

