%solution of heat conduction equation with fixed temp b.c.
  nn=20;n=nn-2;
  %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; t(nn)=20;
  d(1)=-t(1); d(n)=-t(nn);
  %call tri-diagonal solver
  t(2:nn-1)=trid(a,b,c,d)