home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 5.ddi / SPLINES.DI$ / TCSAPI.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  634 b   |  24 lines

  1. function tcs=tcsapi(x,y,z)
  2. %TCSAPI    Bicubic spline interpolant.
  3. %
  4. %        tcs=tcsapi(x,y,z)
  5. %
  6. % returns the bicubic spline interpolant to the data z(i,j)=f(x(i),y(j)),
  7. % using the knot-a-knot end conditions.
  8.  
  9. % Carl de Boor: Feb.4, 1991
  10. % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
  11.  
  12. nx=length(x);ny=length(y);
  13. if (nx < 4|ny < 4), 
  14.    fprintf('tcsapi.m expects at least a 4 by 4 mesh.\n'),
  15.    return
  16. end
  17. knotsx=augknt(x([1,3:(nx-2),nx]),4);
  18. knotsy=augknt(y([1,3:(ny-2),ny]),4);
  19.  
  20. coefs=slvblk(spcol(knotsx,4,x,1),z)';
  21. coefs=slvblk(spcol(knotsy,4,y,1),coefs)';
  22.  
  23. tcs=tspmak(knotsx,knotsy,coefs);
  24.