e02agf

e02agf © Numerical Algorithms Group, 2002.

Purpose

E02AGF Least-squares polynomial fit, values and derivatives may be constrained, arbitrary data points,

Synopsis

[a,s,np1,wrk,ifail] = e02agf(kplus1,x,y,xf,yf,ip<,w,xmin,xmax,ifail>)

Description

 
 This routine determines least-squares polynomial approximations 
 of degrees up to k to the set of data points (x ,y ) with weights
                                                r  r       
 w , for r=1,2,...,m. The value of k, the maximum degree required,
  r                                                      
 is prescribed by the user. At each of the values XF , for r = 
                                                    r         
 1,2,...,MF, of the independent variable x, the approximations and
 their derivatives up to order p  are constrained to have one of 
                                r                               
 the user-specified values YF , for s=1,2,...,n, where
                             s 
       MF
       --
 n=MF+ >  p .
       --  r
       r=1
 
 The approximation of degree i has the property that, subject to 
 the imposed contraints, it minimizes (Sigma) , the sum of the 
                                             i                
 squares of the weighted residuals (epsilon)  for r=1,2,...,m 
                                            r                
 where
 
                     (epsilon) =w (y -f (x ))
                              r  r  r  i  r
 
 and f (x ) is the value of the polynomial approximation of degree
      i  r                                                  
 i at the rth data 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
 
 where x    and x   , specified by the user, are respectively the 
        min      max                                             
 lower and upper end-points of the interval of x over which the 
 polynomials are to be defined.
 
 The polynomial approximation of degree i can be written as
 
             1            _            _            _
             -a   +a   T (x)+...+a  T (x)+...+a  T (x)
             2 i,0  i,1 1         ij j         ii i  
 
          _                                                  
 where T (x) is the Chebyshev polynomial of the first kind of 
        j                                                    
                        _                                 
 degree j with argument x. For i=n,n+1,...,k, the routine produces
 the values of the coefficients a  , for j=0,1,...,i, together 
                                 ij                           
 with the value of the root mean square residual, S , defined as 
                                                   i            
        ___________                                            
       /     --                                                
      /      >                                                 
     /       --                                                
    /        i                                                 
   /     ----------, where m' is the number of data points with 
 \/      (m'+n-i-1)                                            
 non-zero weight.
 
 Values of the approximations may subsequently be computed using 
 E02AEF or E02AKF.
 

Parameters

e02agf

Required Input Arguments:

kplus1                                integer
x (:)                                 real
y (:)                                 real
xf (:)                                real
yf (:)                                real
ip (:)                                integer

Optional Input Arguments:                       <Default>

w (:)                                 real     ones(length(x),1)
xmin                                  real     min(min(x),min(xf))
xmax                                  real     max(max(x),max(xf))
ifail                                 integer  -1

Output Arguments:

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