home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / SMOTH.C < prev    next >
Encoding:
Text File  |  1984-08-14  |  616 b   |  28 lines

  1.    smoth(u,n,w,m,l,smooth)
  2.  
  3.       /* the purpose of this function is to smooth the time series a  */
  4.       /* by weight w.                                                 */
  5.  
  6.       int l,m,n;
  7.       float u[],w[],smooth[];
  8.  
  9.    {
  10.       int i,j,k,kp,lf,lh,ll;
  11.  
  12.       for(i = 0; i <= n-1; i++)
  13.         smooth[i] = 0.;
  14.       lf = l * (m-1) / 2;
  15.       ll = lf + 1;
  16.       lh = n - lf;
  17.  
  18.       for(i = ll; i <= lh; i++)
  19.       {
  20.        k = i - ll + 1;
  21.        for(j = 1; j <= m; j++)
  22.        {
  23.         kp = (j * l) - l + k;
  24.         smooth[i-1] = u[kp-1] * w[j-1] + smooth[i-1];
  25.        }
  26.       }
  27.    }
  28.