function [ derivative_fun, il, ir, dvar ] = first_derivative( var, fun )
% this function evaluates first derivatives
%   INPUT parameters
% x is a vector of length N of which you want the derivative
% etc. etc
%   OUTPUT parameters
% etc. etc.

N=length(fun);
il=(1:1:N-1); ir=(2:1:N);
dvar=var(2)-var(1);
dfun=fun(ir)-fun(il);
derivative_fun=dfun/dvar;

end

