function sol = compactadvectionmol(a,nu,n)
%
% Advection-diffusion equation by the method of lines
% u_t = a u_x + nu u_xx
x = linspace(-1,1,n+2);
h = x(2)-x(1);
function dy = mol(t,y)
    ux = first( y, h ); 
    uxx = second( y, h );
    dy = [0; -a*ux(2:end-1) + nu*uxx(2:end-1); 0];
end
inits = cos(pi*x/2).^2;
inits(1) = 0;
inits(end) = 0;
tf = 2.5;
sol = ode15s( @mol, [0,tf], inits' );
figure(4),
mesh( x, sol.x, sol.y' ), view(160,50),colormap([0,0,0]), axis([-1,1,0,tf,0,1]);
end

