%solution of heat conduction equation with fixed temp b.c. and convective b.c.
  %fin cooling problem
  clear;
  nn=20;n=nn-2;h=1000;k=20;l=1;dx=l/(nn-1);
  th=.1;w=1;p=2*(th+w);area=th*w;m2=h*p/(k*area);
  %tri-diagonal coeffients
  a=diag(eye(n));
  b=(-2-m2*dx*dx)*diag(eye(n));
  c=diag(eye(n));
  d=diag(zeros(n));
  a(1)=0; c(n)=0;
  %modify coeffts for 2nd-order 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)
