function [x,dydx] = DerivFunct(xLimit1,xLimit2,N)
% Derivative function
% This function derives the cosine function between xlim1 and xlim2

x = linspace(xLimit1,xLimit2,N); 
h = (xLimit1 - xLimit2)/N;

dydx = NaN(1,N);

for i = 1:N
    dydx(i) = (cos(x(i)+h)-cos(x(i)))./h;
end
end