1 Introduction
As part of an experimental process, it is common to face up to situations where only a limited
amount of data is available and the estimation of values between consecutive data
points is needed, either for predicting results or inferring conclusions from data.
Although this problem is traditionally approached by function approximation methods
based on polynomial interpolation, a preferred alternative can be found in the
approximation techniques based on piecewiselinear models ^{7}^{,}
^{16}^{,}
^{17}^{,}
^{5}^{,}
^{4} which consists in connecting
consecutive data points by straight line segments through a continuous function.
However, piecewiselinear models have the shortcomings of having zero curvature
between data points, exhibiting abrupt changes at the breakpoints, and having
undefined derivatives. It is precisely the lack of differentiability what limits
their application in such cases where, as a result of derivative computations, the
function
The paper is organized as follows. In Section 2, the absolutevalue function that serves as kernel for the High Level Canonical piecewiselinear model is presented. Section 3 describes the methodology for constructing smoothpiecewise functions. Section 4 shows the application of such methodology by illustrative examples (for one and twodimensional domains). In Section 5 a comparative analysis and discussion about the curve fitting accuracy that can be achieved through the proposed strategy is exposed. The comparison is done among polynomial, splines, smoothpiecewise, and standard piecewiselinear approximation techniques. Finally, Section 6 presents the concluding remarks of this work.
2 Absolutevalue Basisfunction
A relationship between piecewiselinear models and the absolutevalue function is established and reported in many references. Mathematical expressions such as the canonical form of ChuaKang ^{3}^{,} ^{15}^{,} ^{1}^{,} ^{2}, the High Level Canonical representation of PedroJulian et al. ^{11}^{,} ^{8}, the Guzelis ^{6} model, and the Kahlert ^{13}^{,} ^{14} description are emblematic examples where this function appears implicitly. Specifically, in the High Level Canonical model the basisfunction (also expressed in terms of absolutevalue functions) is outlined and easily identified in a detailed methodology by which the approximation function can be constructed. Moreover, this construction methodology is widely reported in literature ^{10}^{,} ^{9}. For these reasons, the smoothing technique which is proposed in this paper takes as reference the basisfunction γ(f_{i} , f_{j}) used in the PedroJulian et al. ^{8} model.
where f_{i} and f_{j} are linear equations used to sketch the linear partitions of the function domain.
3 Methodology for the Construction of SmoothPiecewise Functions
Based on the methodology of PedroJulian et al. ^{8}, our proposal for the construction of smoothpiecewise functions can be summarized as follows.
1. Consider as input the set D of Ndata that contains the breakpoints coordinates of an arbitrary piecewiselinear function. For the onedimensional case
D = {(X_{1}, Y_{1}), (X_{2}, Y_{2}), …, (X_{i}, Y_{i})}, while for the twodimensional case
D = {(X_{1}, Y_{1}, Z_{1}), (X_{2}, Y_{2}, Z_{2}),·…, (X_{i}, Y_{i} , Z_{i})} with i = 1,2,···,N..
2. Define the basisfunction γ(f_{i} , f_{j}). In this step, a suitable approximation for the absolutevalue function is used. In accordance with reference ^{18} a smooth approximation to absolutevalue function is given by
where the plus function (x)_{+} can be approximated by
After combining equation (3) with equation (2), the following smooth approximation is obtained:
After numerical simulations on equation (4), a slight deviation from the absolutevalue function can be observed. In order to obtain more accurate fitting, a constant β is included as
However, taking into account the logarithmic changeofbase formula
being α = 10^{6} and β = 2.3 appropriate values to achieve small tolerance results. An absolutevalue function approximation for α = 4, 6, 8, ..., 20 and β = 2.3 can be observed in Figure 1. In this figure the thin traces (dashed lines) correspond to these approximations while the thickest one corresponds to the exact absolutevalue function y(x) = x. The thin uppermost curve represents the plot for (α = 4, β = 2.3) and the lowest curve for (α = 20, β = 2.3).
3. Divide the function domain into an equally sized grid. For onedimensional functions this partition is done by the set of vertical line equations p_{n}(x) = x = i, with i = 1, 2, · ··, (N  1). For twodimensional functions the line equations p_{n}(x, y) are constructed by following a simplicial subdivision over the plane XY which is composed of three types of traces: vertical (p_{n}(x, y) = x = i), horizontal (p_{n}(x, y) = y = i), and crosswise (p_{n}(x, y) = x  y = i). Particularly, for each of these traces the sweep of i must be in accordance with the boundaries existing along the X and Y axes. For example, if the restrictions X = s_{1} and Y = s_{2} are defined in the XY plane, the sweeps i = {1, 2, ···, (s_{1}  1)}, i = {1, 2, ···,(s_{2} 1)}, and i = {(s_{1} + 1), ( s_{1} + 2), ··· ,0,1, ··· ,(s_{2}  1)} will correspond to the horizontal, vertical, and crosswise traces, respectively.
4. Order the vertexes appropriately. This means that the vertexes must be ordered according to their class. For a twodimensional domain s_{1} x s_{2}, the classzero vertex is the point located at the origin of a coordinate system XY, the classone vertexes are the coordinates (x_{i} , 0) and (0, Y_{j}) (for i = 1, 2,..., s_{1} and j = 1, 2, ..., s_{2}, respectively) and the set of classtwo vertexes is composed by the coordinates (X_{i} , Y_{j}), with the jth index running as j = 1, 2, ... , s_{2} for each ith value from 1 to s_{1}. Likewise, for a onedimensional domain X, bounded by a closed interval [s_{0}, s_{1}], only the vertexes classzero (the coordinate (s_{0}, 0)) and classone (the coordinates (i, 0) for i = 1, 2, ..., s_{1}) exist.
5. Generate the symbolic basisfunctions Λ^{k} = γ^{k} (p_{n}), with the index k closely dependent on the vertical and horizontal partition line equations. For example, in a twodimensional domain s_{1} x s_{2} will be a set P_{H} of (s_{1}  1) horizontal equations, and a set P_{V} of (s_{2}  1) equations. If a cartesian product between these sets is formed, then each ordered pair whose first component is an equation member of P_{H} and whose second component is an equation member of P_{V} will be evaluated in the basisfunction Λ^{k} with k = 0, 1, ..., (s_{1} 1) x (s_{2}  1) . The set of these functions is arranged in vectorial form as
For a onedimensional domain only vertical line partition equations will be presented and k = 0, 1, 2, ... , (s_{1}  1).
6. Evaluate the vector of basisfunctions Λ at each ordered vertex. It is important to observe the similarity that exists between the methodology used to order the vertexes and which is used to construct the matrix Λ_{V} constituted by the rows of evaluated vectors Λ:
where n indicates the number of vertexes. For the onedimensional case, the above procedure is practically the same with the only difference of evaluating two classes of vertexes (zero and one, type).
7. Provide the values of function B_{i} at the breakpoint coordinates by following a sorted order associated with the vertices V^{0}, V^{1} ,..., V^{n} . These values are written as follows
This step is indistinctly implemented in the construction of onedimensional and twodimensional functions.
4 Simulation Results
In this section, three examples to illustrate the effectiveness of the proposed smoothing strategy are presented. We use the software Maple Release 15 to build the mathematical models and plot the approximate functions.
Example 1: Let the sequence of data points D = {(0,0), (1,2), (2,1), (3,3), (4, 1), (5,5)} be used to determine a smoothpiecewise function y_{s}(x) in the range [0,5] of x. In order to have a comparative reference, the methodology of PedroJulian et al.[8] is used to obtain a piecewiselinear function that satisfies the condition of constructing new data points within the range of [0, 5]. As a result, the function y(x) is obtained.
In accordance with the construction methodology presented in the previous section, a smooth function y_{s}(x) can be determined by replacing the γ basisfunction by its logarithmic approximation reported in equation (6). With aid of Maple software, the resulting smooth expression can be simplified in a more compact algebraic form as
With
i  A_{i}  B_{i}  C_{i}  E_{i}  G_{i}  H_{i}  L_{i}  M_{i} 
1,2  ±0.10687  10  +10  ±0.43429  10  +10  +10  10 
3,4  ±0.10687  +10  10  ∓0.43429  10  +10  +10  10 
5,6  ±0.13428  +10  0  ±0.43429  10  0  +10  0 
7,8  ±0.13428  10  0  ∓0.43429  10  0  +10  0 
9,10  ±0.11231  +10  20  ±0.43429  10  +20  +10  20 
11,12  ∓0.11231  10  +20  ±0.43429  10  +20  +10  20 
13,14  ±0.20782  10  +30  ±0.43429  10  +30  +10  30 
15,16  ∓0.20782  +10  30  ±0.43429  10  +30  +10  30 
17,18  ±0.30705  +10  40  ±0.43429  10  +40  +10  40 
19,20  ±0.30705  10  +40  ∓0.43429  10  +40  +10  40 
21, 22  +0.26858  ±10  0  0  0  0  0  0 
23, 24  0.41564  ∓10  ±30  0  0  0  0  0 
25, 26  +0.22462  ∓10  ±20  0  0  0  0  0 
27, 28  0.21375  ∓10  ±10  0  0  0  0  0 
29, 30  +0.61411  ∓10  ±υ40  0  0  0  0  0 
In Figure 2 the dashed line shows the curve of the function y(x) while the solid line depicts the curve for the smoothpiecewise function y_{s}(x).
An error between the piecewiselinear function and its smooth version can be estimated by the percent error formulation
From this figure two important results must be underlined: the error is distributed along each linear segment and a precise fitting is achieved at the breakpoints locations. Moreover, an interesting property can be observed if the differentiability of functions y(x) and y_{s}(x) is put under testing. As can be noted in Figure 4, for the function y(x) only the first order derivative is defined (except in the breakpoints) while the norder derivative (for all n ≥ 1) is zero or not defined.
In contrast, it must be noted that the existence of the higher order derivatives is guaranteed in the smooth function due to the fact that its second derivative is continuous everywhere.
As an example, Figure 5 shows curves for the first and second order derivatives of y_{s}(x).
An important observation regarding to equation (10) is that it can be decomposed into two component functions which can be derived from the parameters reported in Table 1: one for i = 1,···,20, denoted as y_{l}(x), and another for i = 21,···,30, expressed as y_{nl}(x). This means that the smooth piecewise function can be expressed as y_{s}(x) = y_{l}(x) + y_{nl}(x), with a nonlinear behavior of the characteristic curve of y_{s}(x) mainly contained in y_{nl}(x), and a quasilinear behavior strongly related to y_{l}(x). This allows to simplify the smoothpiecewise function in a more compact expression by approximating y_{l}(x) with a line equation y_{le}(x) (for this example, y_{le}(x) = 2.0666667x + 14.84611591). As expected, a good approximation of y_{s}(x) is obtained by y_{nl}(x) + y_{le}(x). Considering this result, equation (10) can be expressed (also in reference to Table 1) in a more compact form:
In Figure 6 graphs of y_{s}(x), y_{l}(x), y_{nl}(x), and y_{le}(x) functions are shown.
Example 2: In this example it is assumed that the only input data that is available to construct an interpolation function z (x, y) is the set of points D.
D={(0,0,1),(1,0,0),(2,0,2),(3,0,0),(0,1,0),(0,2,1), (3,3,0),(1,1,0),(1,2,0),(1,3,2),(2,1,1),(2,2,1),(2,3,0), (3,1,0),(3,2,0),(3,1,3)}.
By following the traditional construction methodology of PedroJulian et al. ^{8}, a two dimensional piecewiselinear
function
Similarly to what was done in the onedimensional example, a precise curve fitting was achieved at the breakpoint coordinates while the maximum deviation between the curves which are depicted in Figure 7 and Figure 8 is observed inside of each simplex in the XY plane. In Figure 9 this effect can be graphically appreciated. Additionally, it must be observed that in contrast with the original piecewiselinear function where the second and higher order derivatives are null, in the smooth function this problem is overcome. In order to illustrate this numerical advantage, surfaces for the first and second derivative of
Example 3: This example illustrates a potential application of the smoothing proposal in a typical problem of control systems engineering. The black curve of Figure 12 represents the transient response of a secondorder system for a unitimpulse excitation. Consider that we are interested in determining the time t_{p} when the maximum peak of this response occurs. Let us consider that the analytical transfer function is not accessible and only a set of equally spaced breakpoints (discrete measurements) is the input data available to construct an approximate function. By following the construction strategy exposed in section 3, the two approximations depicted in Figure 12 can be obtained: piecewiselinear c_{pwl}(t) (red) and smoothpiecewise c_{s}(t) (blue).
In Figure 12, the corresponding smooth and piecewiselinear functions are expressed in the form
and
with the parameters summarized in Table 2 and Table 3, respectively.
i  Â_{i} 

α_{i}=β_{i} = γ_{i} 
0  +0.33134  0.16567  0 
1  0.37020  +0.18510  1 
2  0.19642^{1}  +0.98210 x 10^{1}  2 
3  +0.51145 x 10  0.25572 x 10^{1}  3 
4  +0.16428  0.82140 x 10^{1}  4 
5  +0.11400  0.57000 x 10^{1}  5 
6  +0.9960 x 10^{3}  0.49800 x 10^{3}  6 
7  0.68265x 10^{1}  +0.34132 x 10^{1}  7 
8  0.60870x 10^{1}  +0.30435 x 10^{1}  8 
9  0.12327x 10^{1}  +0.61635 x 10^{2}  9 
10  +0.26036 x 10^{1}  0.13018 x 10^{1}  10 
11  +0.30461 x 10^{1}  0.15230 x 10^{1}  11 
12  +0.11096 x 10^{1}  0.55482 x 10^{1}  12 
13  0.86790x 10^{2}  +0.43395 x 10^{2}  13 
14  0.14392x 10^{1}  +0.71962 x 10^{2}  14 
15  0.74405x 10^{2}  +0.37202 x 10^{2}  15 
16  +0.21605x 10^{2}  0.10802 x 10^{2}  16 
17  +0.64210x 10^{2}  0.32105 x 10^{2}  17 
18  +0.43571 x 10^{2}  0.21786 x 10^{2}  18 
19  0.47850x 10^{4}  +0.23925 x 10^{4}  19 
i  N_{i}  k_{i} 
1, 2  +0.039087  0, 0 
3, 4  0.044564  1, 1 
5, 6  0.019685  2, 2 
7, 8  +0.0061166  3, 3 
9, 10  +0.017621  4, 4 
11, 12  +0.011828  5, 5 
13, 14  0.0002595  6, 6 
15, 16  0.0073524  7, 7 
17, 18  0.0064319  8, 8 
19, 20  0.0010948  9, 9 
21, 22  +0.0028448  10, 10 
23, 24  +0.0031831  11, 11 
25, 26  +0.0011504  12, 12 
27, 28  0.00098792  13, 13 
29, 30  0.0015378  14, 14 
31, 32  0.00077512  15, 15 
33, 34  +0.00027019  16, 16 
35, 36  +0.00072258  17, 17 
37, 38  +0.00039166  18, 18 
39, 40  +0.000014116  19, 19 
From this set of data, we may determine the peak time (t_{p}) by differentiating the approximate function (c_{pwl}(t) or c_{s}(t)) with respect to time (t) and setting this derivative equal to zero
or
However, for the piecewiselinear function a numerical solution cannot be reached, hence the smooth function c_{s}(t) appears as the better approximation alternative. After solving equation (15) with Maple software we obtain t_{p} = 1.193s, which clearly corresponds to the peak time. The piecewiselinear c_{pwl}(t) and the smoothpiecewise c_{s}(t) approximations of the impulse transient response, as well as their derivatives with respect to time, are shown in Figure 13.
In this figure, it is important to observe the notorious difference that exists, from the point of view of function continuity, between the derivatives of these two approximate functions: while
5 Comparative Discussion
In this section, a comparative discussion about the curve fitting performance of the proposed method against other strategies such as polynomial and cubic spline techniques is presented. To start this analysis, it is important to mention that a better curve fitting can be achieved by the smoothpiecewise method, this is because it always imposes on the function the condition of passing through the input data coordinates. Similarly to the piecewiselinear functions, the continuity is also preserved in all the function domain but unlike the piecewiselinear reference, the smoothing proposal adds the function differentiation capability. In contrast, although in polynomial interpolation the function continuity is guaranteed, curve fitting is not very precise what results in a remarkable curve deviation that increases the derivative growing very quickly. An alternative approach to minimizing the curve fitting error is the spline interpolation which consists in restricting the approximation to low degree polynomials (typically, like in our comparative analysis, polynomials of third order degree are preferred) over partitioned sections along the function domain. However, in spite of showing a better curve fitting in comparison to the polynomial counterpart, the best performance is clearly obtained by the smoothpiecewise proposal. To emphasize this characteristic, the smoothpiecewise, polynomial, and spline approximate functions for D_{C} = {(0, 5), (1, 3), (2,10), (3,0), (4, 3), (5,1), (6,10)} are shown in Figure 14.
The error in these approximations can be estimated by the deviation e among the smoothpiecewise, polynomial, and splines curves with respect to the piecewiselinear reference. Such deviations are depicted in Figure 15.
6 Conclusion
In this paper, the proofofconcept related to obtaining smoothpiecewise functions by replacing the basisfunction used in the construction methodology of the High Level Canonical piecewiselinear model was demonstrated by numerical simulations. In accordance with such simulations, smoothpiecewise functions not only preserve curve fitting accuracy but also incorporate derivation capability. By illustrative examples, it was observed that the error between the original piecewiselinear curve and its smoothing version is uniformly distributed along each linear partition, being more pronounced approximately before and after its middle location and extremely reduced around the breakpoints. Moreover, two very important observations must be highlighted: the smooth function can be decomposed into two representations (one nonlinear and other quasilinear), and the number of terms of the resulting smooth function can significantly be reduced due to the fact that a great number of them can be approximated by a line equation. Although its potential application to practical engineering problems was illustrated in Example 3, now our ongoing work centers on exploring alternative applications for this smoothing strategy.