hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_fit_2dspline_grid (e02dc)

Purpose

nag_fit_2dspline_grid (e02dc) computes a bicubic spline approximation to a set of data values, given on a rectangular grid in the xx-yy plane. The knots of the spline are located automatically, but a single parameter must be specified to control the trade-off between closeness of fit and smoothness of fit.

Syntax

[nx, lamda, ny, mu, c, fp, wrk, iwrk, ifail] = e02dc(start, x, y, f, s, nx, lamda, ny, mu, wrk, iwrk, 'mx', mx, 'my', my, 'nxest', nxest, 'nyest', nyest)
[nx, lamda, ny, mu, c, fp, wrk, iwrk, ifail] = nag_fit_2dspline_grid(start, x, y, f, s, nx, lamda, ny, mu, wrk, iwrk, 'mx', mx, 'my', my, 'nxest', nxest, 'nyest', nyest)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 22: lwrk, liwrk have been removed from the interface
.

Description

nag_fit_2dspline_grid (e02dc) determines a smooth bicubic spline approximation s(x,y)s(x,y) to the set of data points (xq,yr,fq,r)(xq,yr,fq,r), for q = 1,2,,mxq=1,2,,mx and r = 1,2,,myr=1,2,,my.
The spline is given in the B-spline representation
nx4ny4
s(x,y) = cijMi(x)Nj(y),
i = 1j = 1
s(x,y) = i=1 nx-4 j=1 ny-4 cij Mi(x) Nj(y) ,
(1)
where Mi(x)Mi(x) and Nj(y)Nj(y) denote normalized cubic B-splines, the former defined on the knots λiλi to λi + 4λi+4 and the latter on the knots μjμj to μj + 4μj+4. For further details, see Hayes and Halliday (1974) for bicubic splines and de Boor (1972) for normalized B-splines.
The total numbers nxnx and nyny of these knots and their values λ1,,λnxλ1,,λnx and μ1,,μnyμ1,,μny are chosen automatically by the function. The knots λ5,,λnx4λ5,,λnx-4 and μ5,,μny4μ5,,μny-4 are the interior knots; they divide the approximation domain [x1,xmx] × [y1,ymy][x1,xmx]×[y1,ymy] into (nx7) × (ny7)(nx-7)×(ny-7) subpanels [λi,λi + 1] × [μj,μj + 1][λi,λi+1]×[μj,μj+1], for i = 4,5,,nx4i=4,5,,nx-4 and j = 4,5,,ny4j=4,5,,ny-4. Then, much as in the curve case (see nag_fit_1dspline_auto (e02be)), the coefficients cijcij are determined as the solution of the following constrained minimization problem:
minimizeη ,
minimizeη ,
(2)
subject to the constraint
mxmy
θ = εq,r2S,
q = 1r = 1
θ = q=1 mx r=1 my ε q,r 2 S ,
(3)
where ηη is a measure of the (lack of) smoothness of s(x,y)s(x,y). Its value depends on the discontinuity jumps in s(x,y)s(x,y) across the boundaries of the subpanels. It is zero only when there are no discontinuities and is positive otherwise, increasing with the size of the jumps (see Dierckx (1982) for details).
  εq,rεq,r denotes the residual fq,rs(xq,yr)fq,r-s(xq,yr),
and SS is a non-negative number specified by you.
By means of the parameter SS, ‘the smoothing factor’, you will then control the balance between smoothness and closeness of fit, as measured by the sum of squares of residuals in (3). If SS is too large, the spline will be too smooth and signal will be lost (underfit); if SS is too small, the spline will pick up too much noise (overfit). In the extreme cases the function will return an interpolating spline (θ = 0)(θ=0) if SS is set to zero, and the least squares bicubic polynomial (η = 0)(η=0) if SS is set very large. Experimenting with SS-values between these two extremes should result in a good compromise. (See Section [Choice of s] for advice on choice of SS.)
The method employed is outlined in Section [Outline of Method Used] and fully described in Dierckx (1981) and Dierckx (1982). It involves an adaptive strategy for locating the knots of the bicubic spline (depending on the function underlying the data and on the value of SS), and an iterative method for solving the constrained minimization problem once the knots have been determined.
Values and derivatives of the computed spline can subsequently be computed by calling nag_fit_2dspline_evalv (e02de), nag_fit_2dspline_evalm (e02df) or nag_fit_2dspline_derivm (e02dh) as described in Section [Evaluation of Computed Spline].

References

de Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
Dierckx P (1981) An improved algorithm for curve fitting with spline functions Report TW54 Department of Computer Science, Katholieke Univerciteit Leuven
Dierckx P (1982) A fast algorithm for smoothing data on a rectangular grid while using spline functions SIAM J. Numer. Anal. 19 1286–1304
Hayes J G and Halliday J (1974) The least squares fitting of cubic spline surfaces to general data sets J. Inst. Math. Appl. 14 89–103
Reinsch C H (1967) Smoothing by spline functions Numer. Math. 10 177–183

Parameters

Compulsory Input Parameters

1:     start – string (length ≥ 1)
Determines whether calculations are to be performed afresh (Cold Start) or whether knots found in previous calls are to be used as an initial estimate of knot placement (Warm Start).
start = 'C'start='C'
The function will build up the knot set starting with no interior knots. No values need be assigned to the parameters nx, ny, lamda, mu, wrk or iwrk.
start = 'W'start='W'
The function will restart the knot-placing strategy using the knots found in a previous call of the function. In this case, the parameters nx, ny, lamda, mu, wrk and iwrk must be unchanged from that previous call. This warm start can save much time in determining a satisfactory set of knots for the given value of s. This is particularly useful when different smoothing factors are used for the same dataset.
Constraint: start = 'C'start='C' or 'W''W'.
2:     x(mx) – double array
mx, the dimension of the array, must satisfy the constraint mx4mx4.
x(q)xq must be set to xqxq, the xx coordinate of the qqth grid point along the xx axis, for q = 1,2,,mxq=1,2,,mx.
Constraint: x1 < x2 < < xmxx1<x2<<xmx.
3:     y(my) – double array
my, the dimension of the array, must satisfy the constraint my4my4.
y(r)yr must be set to yryr, the yy coordinate of the rrth grid point along the yy axis, for r = 1,2,,myr=1,2,,my.
Constraint: y1 < y2 < < ymyy1<y2<<ymy.
4:     f(mx × mymx×my) – double array
f(my × (q1) + r)fmy×(q-1)+r must contain the data value fq,rfq,r, for q = 1,2,,mxq=1,2,,mx and r = 1,2,,myr=1,2,,my.
5:     s – double scalar
The smoothing factor, SS.
If s = 0.0s=0.0, the function returns an interpolating spline.
If s is smaller than machine precision, it is assumed equal to zero.
For advice on the choice of s, see Sections [Description] and [Choice of s].
Constraint: s0.0s0.0.
6:     nx – int64int32nag_int scalar
If the warm start option is used, the value of nx must be left unchanged from the previous call.
7:     lamda(nxest) – double array
nxest, the dimension of the array, must satisfy the constraint
  • nxest8nxest8
  • .
    If the warm start option is used, the values lamda(1),lamda(2),,lamda(nx)lamda1,lamda2,,lamdanx must be left unchanged from the previous call.
    8:     ny – int64int32nag_int scalar
    If the warm start option is used, the value of ny must be left unchanged from the previous call.
    9:     mu(nyest) – double array
    nyest, the dimension of the array, must satisfy the constraint
  • nyest8nyest8
  • .
    If the warm start option is used, the values mu(1),mu(2),,mu(ny)mu1,mu2,,muny must be left unchanged from the previous call.
    10:   wrk(lwrk) – double array
    lwrk, the dimension of the array, must satisfy the constraint lwrk4 × (mx + my) + 11 × (nxest + nyest) + nxest × my +   max (my,nxest) + 54lwrk4×(mx+my)+11×(nxest+nyest)+nxest×my+ max(my,nxest)+54.
    If the warm start option is used, on entry, the values wrk(1),,wrk(4)wrk1,,wrk4 must be left unchanged from the previous call.
    This array is used as workspace.
    11:   iwrk(liwrk) – int64int32nag_int array
    liwrk, the dimension of the array, must satisfy the constraint liwrk3 + mx + my + nxest + nyestliwrk3+mx+my+nxest+nyest.
    If the warm start option is used, on entry, the values iwrk(1),,iwrk(3)iwrk1,,iwrk3 must be left unchanged from the previous call.
    This array is used as workspace.

    Optional Input Parameters

    1:     mx – int64int32nag_int scalar
    Default: The dimension of the array x.
    mxmx, the number of grid points along the xx axis.
    Constraint: mx4mx4.
    2:     my – int64int32nag_int scalar
    Default: The dimension of the array y.
    mymy, the number of grid points along the yy axis.
    Constraint: my4my4.
    3:     nxest – int64int32nag_int scalar
    4:     nyest – int64int32nag_int scalar
    Default: For nxest, the dimension of the array lamda. For nyest, the dimension of the array mu.
    An upper bound for the number of knots nxnx and nyny required in the xx- and yy-directions respectively.
    In most practical situations, nxest = mx / 2nxest=mx/2 and nyest = my / 2nyest=my/2 is sufficient. nxest and nyest never need to be larger than mx + 4mx+4 and my + 4my+4 respectively, the numbers of knots needed for interpolation (s = 0.0)(s=0.0). See also Section [Choice of nxest and nyest].
    Constraints:

    Input Parameters Omitted from the MATLAB Interface

    lwrk liwrk

    Output Parameters

    1:     nx – int64int32nag_int scalar
    The total number of knots, nxnx, of the computed spline with respect to the xx variable.
    2:     lamda(nxest) – double array
    Contains the complete set of knots λiλi associated with the xx variable, i.e., the interior knots lamda(5),lamda(6),,lamda(nx4)lamda5,lamda6,,lamdanx-4 as well as the additional knots
    lamda(1) = lamda(2) = lamda(3) = lamda(4) = x(1)
    lamda1=lamda2=lamda3=lamda4=x1
    and
    lamda(nx 3) = lamda(nx 2) = lamda(nx 1) = lamda(nx) = x(mx)
    lamdanx- 3=lamdanx- 2=lamdanx- 1=lamdanx=xmx
    needed for the B-spline representation.
    3:     ny – int64int32nag_int scalar
    The total number of knots, nyny, of the computed spline with respect to the yy variable.
    4:     mu(nyest) – double array
    Contains the complete set of knots μiμi associated with the yy variable, i.e., the interior knots mu(5),mu(6),,mu(ny4)mu5,mu6,,muny-4 as well as the additional knots
    mu(1) = mu(2) = mu(3) = mu(4) = y(1)
    mu1=mu2=mu3=mu4=y1
    and
    mu(ny 3) = mu(ny 2) = mu(ny 1) = mu(ny) = y(my)
    muny- 3=muny- 2=muny- 1=muny=ymy
    needed for the B-spline representation.
    5:     c((nxest4) × (nyest4)(nxest-4)×(nyest-4)) – double array
    The coefficients of the spline approximation. c((ny4) × (i1) + j)c((ny-4)×(i-1)+j) is the coefficient cijcij defined in Section [Description].
    6:     fp – double scalar
    The sum of squared residuals, θθ, of the computed spline approximation. If fp = 0.0fp=0.0, this is an interpolating spline. fp should equal ss within a relative tolerance of 0.0010.001 unless nx = ny = 8nx=ny=8, when the spline has no interior knots and so is simply a bicubic polynomial. For knots to be inserted, s must be set to a value below the value of fp produced in this case.
    7:     wrk(lwrk) – double array
    This array is used as workspace.
    8:     iwrk(liwrk) – int64int32nag_int array
    This array is used as workspace.
    9:     ifail – int64int32nag_int scalar
    ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

    Error Indicators and Warnings

    Errors or warnings detected by the function:
      ifail = 1ifail=1
    On entry,start'C'start'C' or 'W''W',
    ormx < 4mx<4,
    ormy < 4my<4,
    ors < 0.0s<0.0,
    ors = 0.0s=0.0 and nxest < mx + 4nxest<mx+4,
    ors = 0.0s=0.0 and nyest < my + 4nyest<my+4,
    ornxest < 8nxest<8,
    ornyest < 8nyest<8,
    orlwrk < 4 × (mx + my) + 11 × (nxest + nyest) + nxest × my +   max (my,nxest) + 54lwrk<4×(mx+my)+11×(nxest+nyest)+nxest×my+ max(my,nxest)+54,
    orliwrk < 3 + mx + my + nxest + nyestliwrk<3+mx+my+nxest+nyest.
      ifail = 2ifail=2
    The values of x(q)xq, for q = 1,2,,mxq=1,2,,mx, are not in strictly increasing order.
      ifail = 3ifail=3
    The values of y(r)yr, for r = 1,2,,myr=1,2,,my, are not in strictly increasing order.
      ifail = 4ifail=4
    The number of knots required is greater than allowed by nxest and nyest. Try increasing nxest and/or nyest and, if necessary, supplying larger arrays for the parameters lamda, mu, c, wrk and iwrk. However, if nxest and nyest are already large, say nxest > mx / 2nxest>mx/2 and nyest > my / 2nyest>my/2, then this error exit may indicate that s is too small.
      ifail = 5ifail=5
    The iterative process used to compute the coefficients of the approximating spline has failed to converge. This error exit may occur if s has been set very small. If the error persists with increased s, contact NAG.
    If ifail = 4ifail=4 or 55, a spline approximation is returned, but it fails to satisfy the fitting criterion (see (2) and (3) in Section [Description]) – perhaps by only a small amount, however.

    Accuracy

    On successful exit, the approximation returned is such that its sum of squared residuals fp is equal to the smoothing factor ss, up to a specified relative tolerance of 0.0010.001 – except that if nx = 8nx=8 and ny = 8ny=8, fp may be significantly less than ss: in this case the computed spline is simply the least squares bicubic polynomial approximation of degree 33, i.e., a spline with no interior knots.

    Further Comments

    Timing

    The time taken for a call of nag_fit_2dspline_grid (e02dc) depends on the complexity of the shape of the data, the value of the smoothing factor SS, and the number of data points. If nag_fit_2dspline_grid (e02dc) is to be called for different values of SS, much time can be saved by setting start = 'W'start='W' after the first call.

    Weighting of Data Points

    nag_fit_2dspline_grid (e02dc) does not allow individual weighting of the data values. If these were determined to widely differing accuracies, it may be better to use nag_fit_2dspline_sctr (e02dd). The computation time would be very much longer, however.

    Choice of s

    If the standard deviation of fq,rfq,r is the same for all qq and rr (the case for which nag_fit_2dspline_grid (e02dc) is designed – see Section [Weighting of Data Points].) and known to be equal, at least approximately, to σσ, say, then following Reinsch (1967) and choosing the parameter s in the range σ2(m ± sqrt(2m))σ2(m±2m), where m = mxmym=mxmy, is likely to give a good start in the search for a satisfactory value. If the standard deviations vary, the sum of their squares over all the data points could be used. Otherwise experimenting with different values of s will be required from the start, taking account of the remarks in Section [Description].
    In that case, in view of computation time and memory requirements, it is recommended to start with a very large value for s and so determine the least squares bicubic polynomial; the value returned for fp, call it fp0fp0, gives an upper bound for s. Then progressively decrease the value of s to obtain closer fits – say by a factor of 1010 in the beginning, i.e., s = fp0 / 10s=fp0/10, s = fp0 / 100s=fp0/100, and so on, and more carefully as the approximation shows more details.
    The number of knots of the spline returned, and their location, generally depend on the value of ss and on the behaviour of the function underlying the data. However, if nag_fit_2dspline_grid (e02dc) is called with start = 'W'start='W', the knots returned may also depend on the smoothing factors of the previous calls. Therefore if, after a number of trials with different values of ss and start = 'W'start='W', a fit can finally be accepted as satisfactory, it may be worthwhile to call nag_fit_2dspline_grid (e02dc) once more with the selected value for ss but now using start = 'C'start='C'. Often, nag_fit_2dspline_grid (e02dc) then returns an approximation with the same quality of fit but with fewer knots, which is therefore better if data reduction is also important.

    Choice of nxest and nyest

    The number of knots may also depend on the upper bounds nxest and nyest. Indeed, if at a certain stage in nag_fit_2dspline_grid (e02dc) the number of knots in one direction (say nxnx) has reached the value of its upper bound (nxest), then from that moment on all subsequent knots are added in the other (y)(y) direction. Therefore you have the option of limiting the number of knots the function locates in any direction. For example, by setting nxest = 8nxest=8 (the lowest allowable value for nxest), you can indicate that you want an approximation which is a simple cubic polynomial in the variable xx.

    Outline of Method Used

    If S = 0S=0, the requisite number of knots is known in advance, i.e., nx = mx + 4nx=mx+4 and ny = my + 4ny=my+4; the interior knots are located immediately as λi = xi2λi=xi-2 and μj = yj2μj=yj-2, for i = 5,6,,nx4i=5,6,,nx-4 and j = 5,6,,ny4j=5,6,,ny-4. The corresponding least squares spline is then an interpolating spline and therefore a solution of the problem.
    If S > 0S>0, suitable knot sets are built up in stages (starting with no interior knots in the case of a cold start but with the knot set found in a previous call if a warm start is chosen). At each stage, a bicubic spline is fitted to the data by least squares, and θθ, the sum of squares of residuals, is computed. If θ > Sθ>S, new knots are added to one knot set or the other so as to reduce θθ at the next stage. The new knots are located in intervals where the fit is particularly poor, their number depending on the value of SS and on the progress made so far in reducing θθ. Sooner or later, we find that θSθS and at that point the knot sets are accepted. The function then goes on to compute the (unique) spline which has these knot sets and which satisfies the full fitting criterion specified by (2) and (3). The theoretical solution has θ = Sθ=S. The function computes the spline by an iterative scheme which is ended when θ = Sθ=S within a relative tolerance of 0.0010.001. The main part of each iteration consists of a linear least squares computation of special form, done in a similarly stable and efficient manner as in nag_fit_1dspline_knots (e02ba) for least squares curve-fitting.
    An exception occurs when the function finds at the start that, even with no interior knots (nx = ny = 8)(nx=ny=8), the least squares spline already has its sum of residuals SS. In this case, since this spline (which is simply a bicubic polynomial) also has an optimal value for the smoothness measure ηη, namely zero, it is returned at once as the (trivial) solution. It will usually mean that SS has been chosen too large.
    For further details of the algorithm and its use see Dierckx (1982).

    Evaluation of Computed Spline

    The values of the computed spline at the points (xr,yr) (xr,yr) , for r = 1,2,,mr=1,2,,m, may be obtained in the double array ff (see nag_fit_2dspline_evalv (e02de)), of length at least mm, by the following call:
    [ff, ifail] = e02de(x, y, lamda, mu, c);
    
    where M = mM=m and the coordinates xrxr, yryr are stored in X(k)X(k), Y(k)Y(k). PX and PY have the same values as nx and ny as output from nag_fit_2dspline_grid (e02dc), and LAMDA, MU and C have the same values as lamda, mu and c output from nag_fit_2dspline_grid (e02dc). WRK is a double workspace array of length at least PY4PY-4, and IWRK is an integer workspace array of length at least PY4PY-4.
    To evaluate the computed spline on a mxmx by mymy rectangular grid of points in the xx-yy plane, which is defined by the xx coordinates stored in X(q)X(q), for q = 1,2,,mxq=1,2,,mx, and the yy coordinates stored in Y(r)Y(r), for r = 1,2,,myr=1,2,,my, returning the results in the double array ff (see nag_fit_2dspline_evalm (e02df)) which is of length at least mx × mymx×my, the following call may be used:
    [ff, ifail] = e02df(x, y, lamda, mu, c);
    
    where MX = mxMX=mx, MY = myMY=my. LAMDA, MU and C have the same values as lamda, mu and c output from nag_fit_2dspline_grid (e02dc). WRK is a double workspace array of length at least LWRK = min (nwrk1,nwrk2) LWRK = min(nwrk1,nwrk2) , where nwrk1 = MX × 4 + PXnwrk1=MX×4+PX and nwrk2 = MY × 4 + PYnwrk2=MY×4+PY. IWRK is an integer workspace array of length at least LIWRK = MY + PY4LIWRK=MY+PY-4 if nwrk1nwrk2nwrk1nwrk2, or MX + PX4MX+PX-4 otherwise.
    The result of the spline evaluated at grid point (q,r)(q,r) is returned in element (MY × (q1) + r)(MY×(q-1)+r) of the array FG.

    Example

    function nag_fit_2dspline_grid_example
    start = 'C';
    x = [0;
         0.5;
         1;
         1.5;
         2;
         2.5;
         3;
         3.5;
         4;
         4.5;
         5];
    y = [0;
         0.5;
         1;
         1.5;
         2;
         2.5;
         3;
         3.5;
         4];
    f = [1;
         0.88758;
         0.5403;
         0.070737;
         -0.41515;
         -0.80114;
         -0.97999;
         -0.93446;
         -0.65664;
         1.5;
         1.3564;
         0.82045;
         0.10611;
         -0.62422;
         -1.2317;
         -1.485;
         -1.3047;
         -0.98547;
         2.06;
         1.7552;
         1.0806;
         0.15147;
         -0.83229;
         -1.6023;
         -1.97;
         -1.8729;
         -1.4073;
         2.57;
         2.124;
         1.3508;
         0.17684;
         -1.0404;
         -2.0029;
         -2.475;
         -2.3511;
         -1.6741;
         3;
         2.6427;
         1.6309;
         0.21221;
         -1.2484;
         -2.2034;
         -2.97;
         -2.8094;
         -1.9809;
         3.5;
         3.1715;
         1.8611;
         0.24458;
         -1.4565;
         -2.864;
         -3.265;
         -3.2776;
         -2.2878;
         4.04;
         3.5103;
         2.0612;
         0.28595;
         -1.6946;
         -3.2046;
         -3.96;
         -3.7958;
         -2.6146;
         4.5;
         3.9391;
         2.4314;
         0.31632;
         -1.8627;
         -3.6351;
         -4.455;
         -4.2141;
         -2.9314;
         5.04;
         4.3879;
         2.7515;
         0.35369;
         -2.0707;
         -4.0057;
         -4.97;
         -4.6823;
         -3.2382;
         5.505;
         4.8367;
         2.9717;
         0.38505;
         -2.2888;
         -4.4033;
         -5.445;
         -5.1405;
         -3.595;
         6;
         5.2755;
         3.2418;
         0.42442;
         -2.4769;
         -4.8169;
         -5.93;
         -5.6387;
         -3.9319];
    s = 0.1;
    nx = int64(0);
    lamda = zeros(15, 1);
    ny = int64(-1077703852);
    mu = zeros(13, 1);
    wrk = zeros(592, 1);
    iwrk = zeros(51, 1, 'int64');
    [nxOut, lamdaOut, nyOut, muOut, c, fp, wrkOut, iwrkOut, ifail] = ...
        nag_fit_2dspline_grid(start, x, y, f, s, nx, lamda, ny, mu, wrk, iwrk);
     nxOut, lamdaOut, nyOut, muOut, c, fp, ifail
    
     
    
    nxOut =
    
                       10
    
    
    lamdaOut =
    
             0
             0
             0
             0
        1.5000
        2.5000
        5.0000
        5.0000
        5.0000
        5.0000
             0
             0
             0
             0
             0
    
    
    nyOut =
    
                       13
    
    
    muOut =
    
             0
             0
             0
             0
        1.0000
        2.0000
        2.5000
        3.0000
        3.5000
        4.0000
        4.0000
        4.0000
        4.0000
    
    
    c =
    
        0.9918
        1.0546
        0.6098
       -0.2915
       -0.8476
       -1.0168
       -0.9529
       -0.7711
       -0.6476
        1.5381
        1.5270
        0.9557
       -0.4199
       -1.3296
       -1.5952
       -1.3381
       -1.0914
       -1.0373
        2.3913
        2.2441
        1.5587
       -0.7399
       -1.8521
       -2.4022
       -2.2844
       -1.8488
       -1.5936
        3.9845
        4.2217
        2.3458
       -1.1763
       -3.3468
       -3.9390
       -3.9559
       -3.2549
       -2.5887
        5.2138
        5.0860
        3.3860
       -1.5527
       -4.3628
       -5.4680
       -5.0032
       -3.9444
       -3.3485
        5.9965
        6.0821
        3.7716
       -1.7775
       -5.0085
       -6.1656
       -5.8709
       -4.7297
       -3.9330
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
    
    
    fp =
    
        0.1000
    
    
    ifail =
    
                        0
    
    
    
    function e02dc_example
    start = 'C';
    x = [0;
         0.5;
         1;
         1.5;
         2;
         2.5;
         3;
         3.5;
         4;
         4.5;
         5];
    y = [0;
         0.5;
         1;
         1.5;
         2;
         2.5;
         3;
         3.5;
         4];
    f = [1;
         0.88758;
         0.5403;
         0.070737;
         -0.41515;
         -0.80114;
         -0.97999;
         -0.93446;
         -0.65664;
         1.5;
         1.3564;
         0.82045;
         0.10611;
         -0.62422;
         -1.2317;
         -1.485;
         -1.3047;
         -0.98547;
         2.06;
         1.7552;
         1.0806;
         0.15147;
         -0.83229;
         -1.6023;
         -1.97;
         -1.8729;
         -1.4073;
         2.57;
         2.124;
         1.3508;
         0.17684;
         -1.0404;
         -2.0029;
         -2.475;
         -2.3511;
         -1.6741;
         3;
         2.6427;
         1.6309;
         0.21221;
         -1.2484;
         -2.2034;
         -2.97;
         -2.8094;
         -1.9809;
         3.5;
         3.1715;
         1.8611;
         0.24458;
         -1.4565;
         -2.864;
         -3.265;
         -3.2776;
         -2.2878;
         4.04;
         3.5103;
         2.0612;
         0.28595;
         -1.6946;
         -3.2046;
         -3.96;
         -3.7958;
         -2.6146;
         4.5;
         3.9391;
         2.4314;
         0.31632;
         -1.8627;
         -3.6351;
         -4.455;
         -4.2141;
         -2.9314;
         5.04;
         4.3879;
         2.7515;
         0.35369;
         -2.0707;
         -4.0057;
         -4.97;
         -4.6823;
         -3.2382;
         5.505;
         4.8367;
         2.9717;
         0.38505;
         -2.2888;
         -4.4033;
         -5.445;
         -5.1405;
         -3.595;
         6;
         5.2755;
         3.2418;
         0.42442;
         -2.4769;
         -4.8169;
         -5.93;
         -5.6387;
         -3.9319];
    s = 0.1;
    nx = int64(0);
    lamda = zeros(15, 1);
    ny = int64(-1077703852);
    mu = zeros(13, 1);
    wrk = zeros(592, 1);
    iwrk = zeros(51, 1, 'int64');
    [nxOut, lamdaOut, nyOut, muOut, c, fp, wrkOut, iwrkOut, ifail] = ...
        e02dc(start, x, y, f, s, nx, lamda, ny, mu, wrk, iwrk);
     nxOut, lamdaOut, nyOut, muOut, c, fp, ifail
    
     
    
    nxOut =
    
                       10
    
    
    lamdaOut =
    
             0
             0
             0
             0
        1.5000
        2.5000
        5.0000
        5.0000
        5.0000
        5.0000
             0
             0
             0
             0
             0
    
    
    nyOut =
    
                       13
    
    
    muOut =
    
             0
             0
             0
             0
        1.0000
        2.0000
        2.5000
        3.0000
        3.5000
        4.0000
        4.0000
        4.0000
        4.0000
    
    
    c =
    
        0.9918
        1.0546
        0.6098
       -0.2915
       -0.8476
       -1.0168
       -0.9529
       -0.7711
       -0.6476
        1.5381
        1.5270
        0.9557
       -0.4199
       -1.3296
       -1.5952
       -1.3381
       -1.0914
       -1.0373
        2.3913
        2.2441
        1.5587
       -0.7399
       -1.8521
       -2.4022
       -2.2844
       -1.8488
       -1.5936
        3.9845
        4.2217
        2.3458
       -1.1763
       -3.3468
       -3.9390
       -3.9559
       -3.2549
       -2.5887
        5.2138
        5.0860
        3.3860
       -1.5527
       -4.3628
       -5.4680
       -5.0032
       -3.9444
       -3.3485
        5.9965
        6.0821
        3.7716
       -1.7775
       -5.0085
       -6.1656
       -5.8709
       -4.7297
       -3.9330
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
             0
    
    
    fp =
    
        0.1000
    
    
    ifail =
    
                        0
    
    
    

    PDF version (NAG web site, 64-bit version, 64-bit version)
    Chapter Contents
    Chapter Introduction
    NAG Toolbox

    © The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013