function [ut]=derv(n,t,u)
%
% Function derv computes the derivative vector 
% for the nonlinear PDE
%
% Problem parameters
  [alpha,k,sigma,L,ui,ua]=par1;
  [ a, e, rhos,cps,ls,cs]=par2;
%
% Spatial grid
  dx=1.0/(n-2);
  dxs=dx*dx;
%
% Insulation
  for i=1:n-2
    if(i==1)
      u0=u(2)+2.0*dx*L*(sigma/k)*(a*ua^4-e*u(1)^4);
      ut(1)=(u(2)-2.0*u(1)+u0)/dxs;
    else
      ut(i)=(u(i+1)-2.0*u(i)+u(i-1))/dxs;
    end
  end
%
% Steel
  ut(n)=(k*L/alpha)*(1.0/cs)*(u(n-2)-u(n-1))/dx;
  ut(n-1)=ut(n);
%
% End of derv
