% Approximates the derivative of the function f
% Make sure the file f.m is contained in the same folder as this file

% Input: x = value at which you want to find the derivative
%        h = how close you want to the limit (h -> 0)

% Output: LLD = limit of the difference equation from the left side
%         RLD = limit of the difference equation from the right side

function [LLD,RLD] = derivative(h,x)

% left limit
LLD = (f(x-h)-f(x))/(-h);

% right limit
RLD = (f(x+h)-f(x))/(h);