e02adf

e02adf © Numerical Algorithms Group, 2002.

Purpose

E02ADF Least-squares curve fit, by polynomials, arbitrary data points

Synopsis

[a,s,ifail] = e02adf(kplus1,x,y<,w,ifail>)

Description

 
 This routine determines least-squares polynomial approximations 
 of degrees 0,1,...,k to the set of data points (x ,y ) with 
                                                  r  r      
 weights w , for r=1,2,...,m.
          r                 
 
 The approximation of degree i has the property that it minimizes 
 (sigma)  the sum of squares of the weighted residuals (epsilon) ,
        i                                                       r
 where
 
                       (epsilon) =w (y -f )
                                r  r  r  r
 
 and f  is the value of the polynomial of degree i at the rth data
      r                                                       
 point.
 
 Each polynomial is represented in Chebyshev-series form with 
                     _                                          
 normalised argument x. This argument lies in the range -1 to +1 
 and is related to the original variable x by the linear 
 transformation
 
                           (2x-x   -x   )
                        _       max  min 
                        x= --------------.
                            (x   -x   )  
                              max  min   
 
 Here x    and x    are respectively the largest and smallest 
       max      min                                          
 values of x . The polynomial approximation of degree i is 
            r                                             
 represented as
 
      1         _           _           _                 _
      -a     T (x)+a     T (x)+a     T (x)+...+a       T (x),
      2 i+1,1 0     i+1,2 1     i+1,3 2         i+1,i+1 i  
 
          _                                                  
 where T (x) is the Chebyshev polynomial of the first kind of 
        j                                                    
                         _ 
 degree j with argument (x).
 
 For i=0,1,...,k, the routine produces the values of a       , for
                                                      i+1,j+1  
 j=0,1,...,i, together with the value of the root mean square 
                  _________                                    
                 / (sigma)                                     
                /         i                                    
 residual s =  /   --------. In the case m=i+1 the routine sets 
           i \/     m-i-1                                      
 the value of s  to zero.
               i    
 
 Subsequent evaluation of the Chebyshev-series representations of 
 the polynomial approximations should be carried out using E02AEF.
 

Parameters

e02adf

Required Input Arguments:

kplus1                                integer
x (:)                                 real
y (:)                                 real

Optional Input Arguments:                       <Default>

w (:)                                 real     ones(length(x),1)
ifail                                 integer  -1

Output Arguments:

a (:,kplus1)                          real
s (kplus1)                            real
ifail                                 integer