%solution of heat conduction equation with fixed temp b.c. and convective b.c.
  nn=20;n=nn-2;h=100;k=20;l=1;dx=l/(nn-1);
  %tri-diagonal coeffients
  a=diag(eye(n));
  b=-2*diag(eye(n));
  c=diag(eye(n));
  d=diag(zeros(n));
  a(1)=0; c(n)=0;
  %modify coeffts for b.c. - elimination
  t(1)=100; 
  d(1)=-t(1); denom=(3/2+h*dx/k);
  a(n)=a(n)-.5/denom;b(n)=b(n)+2/denom;
  %call tri-diagonal solver
  t(2:nn-1)=trid(a,b,c,d);
  t(nn)=-.5/denom*t(nn-2)+2/denom*t(nn-1)
