function res = residadvectionmol(a,nu,sol,n,t0,tf,nr,scale)
x = cos( pi*(0:n+1)/(n+1) );
D = gallery('chebspec',n+2);
j0 = find(sol.x >= t0 );
jf = find(sol.x <= tf );
t = RefineMesh(sol.x(j0(1):jf(end)),nr);
em = length(t);
[u,ut] = deval( sol, t );
ux = D*[zeros(1,size(u,2));u;zeros(1,size(u,2))];
xi = RefineMesh(x,nr);
en = length(xi);
res = zeros(en,em);
w = genbarywts( x, 1 );
for i=2:em,
  [uxi, uxxi] = hermiteval( [0;u(:,i);0], xi, x, 1, w, D );
  utxi = hermiteval( [0;ut(:,i);0], xi, x, 1, w, D);
  [uxxi2, uxxxi] = hermiteval( ux(:,i), xi, x, 1, w, D );
  res(:,i) = utxi + a*uxxi - nu*uxxxi;
end
figure(2)
colormap([0,0,0])
mesh( t, xi(2:end-1), res(2:end-1,:) ) , axis([t0,tf, -1, 1, -scale,scale]), view(70,60)
set(gca,'fontsize',16);
