function uprime=Heat_diff(t,u,k,kappa,r,D2)

%This function outputs the temporal derivatives of the heat equation using
%a centered difference approximation to the spatial derivative.
%The output of this program is used as the input for Matlab's built in ODE
%solvers.

%The function takes four inputs:
%
%1. t=this is the time domain we are integrating over and is necessary for
%   Matlab's built in ODE solvers. 
%
%2. u= is a vector containing the height of each node point u0.
%
%3. n=the number of spatial node points being used.
%
%4. h=spacing between node points
%
%5. k=diffusion constant.
%
%6. D2=the matrix of second partial deriviative. IMPORTANT: This
%   approximation assumes dirichlet bounary conditions at 0 and 1.

%The function has one output
%
%1. uprime= is the approximation to the temperal
%   derivatives of u.

uprime=k*D2*u+r*(kappa-u).*u;

end

