%---------------------------------------------------%
% diff_first(): evaluates the derivative of f       %
%---------------------------------------------------%
% INPUTs: to be provided
% a --- scalar: lower bound of the interval
% b --- scalar: upper bound of the interval
% N --- number of point in the grid
% fun --- anonymous function

function [x, fp, deltax, il, ir] = diff_first(a, b, N, fun)
x=linspace(a ,b, N);
f=fun(x);
il=(1:1:N-1); ir=(2:1:N);
deltax=x(ir)-x(il);
deltaf=f(ir)-f(il);
fp=deltaf./deltax;
end