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

  1. % DIFEQSET    Used by DIFEQDEM.
  2. echo off
  3.                                          %latest change: December 25, 1989
  4. % Copyright (c) 1990-92 by Carl de Boor and The MathWorks, Inc.
  5.  
  6.    % We get a refined break sequence from current  z  via  newknt
  7.    breaks = newknt(sp2pp(z),ninterv+1);
  8.    knots = augknt(breaks,4,2);
  9.    n = length(knots)-k;
  10.    
  11.    % ... and generate the corresponding set of collocation points.
  12.    ninterv = length(breaks)-1;
  13.    (breaks(2:ninterv+1)+breaks(1:ninterv))/2;
  14.    ans'*[1 1] + diff(breaks)'*gauss;
  15.    colpnts = sort(ans(:)');
  16.    points = [0,colpnts,1];
  17.    
  18.    % We use  spcol  to supply the matrix
  19.    colmat = spcol(knots,k,sort([points points points]));
  20.    
  21.    % ... and use our current approximate solution  z  as the initial guess:
  22.    intmat = colmat([2 1+[1:(n-2)]*3,1+(n-1)*3],:);
  23.    y = spmak(knots,[0 fnval(z,colpnts) 0]/intmat');
  24.  
  25. echo on
  26.