Measurement Data Fitting Based on Moving Least Squares Method

In the electromagnetic field measurement data postprocessing, this paper introduced the moving least squares (MLS) approximation method. The MLS combines the concept of moving window and compact support weighting functions. It can be regarded as a combination of weighted least squares and segmented least square. The MLS not only can acquire higher precision even with low order basis functions, but also has good stability due to its local approximation scheme. An attractive property of MLS is its flexible adjustment ability. Therefore, the data fitting can be easily adjusted by tuning weighting function’s parameters. Numerical examples and measurement data processing reveal its superior performance in curves fitting and surface construction. So the MLS is a promising method for measurement data processing.


Introduction
The measurement data of electromagnetic (EM) field plays a key role in EM environment assessment. However, the measurement points are limited, and, in order to describe the EM field distribution more accurately, the postprocessing is necessary. The data acquiring for nonmeasurement point is essentially a typical function approximation or surface construction problem. Owing to the instruments errors, environmental interference, or terrain changes, the deviation emerges inevitably and the fitting method is preferred in the postprocessing.
Currently, the least squares (LS) method has been most widely used in data fitting. The commonly used basis functions are polynomials [1], rational functions [2], Gaussian, exponential, smoothing spline in curve fitting, the B-spline [3], the nonuniform rational B-splines (NURBS) [4], Bézier surfaces [5], and radial basis function [6] in surface construction. And, simultaneously, the deformations of LS as RLS (recursive least squares), TLS (total least squares), PLS (partial least squares), WLS (weighted least squares), GLS (generalized least squares), and SLS (segmented least squares) have been also put forward. However, all the above LS based methods are global approximation schemes which are not suitable for large amount of data, irregular or scattered distribution cases. So the moving least squares (MLS) method which is local approximation was proposed in measurement data processing.
The MLS approximation was introduced by Lancaster and Salkauskas for surface generation problems [7]. It has been used for surface construction with unorganized point clouds [8], regression in learning theory [9], and sensitivity analysis [10]. However, the major applications of MLS are to form a lot of meshless methods [11], as the diffuse element method (DEM) [12], the well-known element-free Galerkin method (EFGM) [13], and the meshless local Petrov-Galerkin method [14]. These kinds of methods have high computational precision and stability. The disadvantage of the MLS lies in the algebra equations system that is sometimes ill-conditioned, so Cheng and Peng [15] proposed the improved method. The error estimates and stability of MLS [16][17][18][19] and the variation as complex or Hermite [20,21] were intensively discussed. On the whole, the researches of MLS approximation theory are much less than applications.
As a data fitting method, the MLS can be regarded as a combination of WLS and SLS because of its compact support weighting function. Moreover, the introduced moving window in MLS shows superior performance versus SLS. Firstly, 2 Mathematical Problems in Engineering the compact support weighting function indicates that only partial measurement data nearby the unknown measurement point are involved in calculating which indicates the MLS inherits localized treatment of SLS. Then, the segmentation is rigid in SLS and causes the problems of how to select the segment and fitting discontinuity. However, the moving window in MLS acts as a soft segment. The segment selection is avoided and the fitting continuity and smoothness are guaranteed. Finally, weighting function parameters provide a convenient adjustment option for MLS.
Hence, this paper proposed the MLS method for measurement data fitting. The structure of the paper is as follows. In Section 2, a brief description is given for MLS approximation. Then, the weighting function is discussed in Section 3. In Section 4, the numerical examples of curve fitting are carried out. And finally, the measurement data fitting for substation is implemented in Section 5. Conclusions are drawn in Section 6.
The obvious difference between the traditional LS method and MLS is the coefficients. For MLS, the coefficients a(x) = [ 1 (x), 2 (x), . . . , (x)] varied with x, while they are constant in LS. In order to determine the coefficients, a function which is similar to WLS is defined as where ( ), = 1, 2, . . . , , are the given nodes. ( ) are the weighting functions with compact support which can be also represented as ( − ). The subscript " " means the center of ( ) is located in . The schematic diagram of weighted scheme in MLS is shown in Figure 1.
The weight is still imposed on the square error between fitting and given value. However, with respect to the WLS, the main difference is the weighting function which means a locally defined function in MLS versus a global one in WLS. Owing to the compact support, only the nodes that located in the support domain are involved for coefficients calculation, so it is similar to the SLS. The matrix form for (2) can be rewritten as ] .
Minimizing (3) with the respect to coefficients a(x), the following expression can be obtained: Further, the coefficients a(x) are where Φ( ) is known as the MLS shape function which affects fundamentally the approximate performance. Hence, MLS can be regarded as a combination of WLS and SLS. The process of MLS approximation for one-dimensional case can be summarized in the following pattern.

Weighting Function
Weighting function plays a very important role in MLS. In the previous pattern, the vector f is given and the matrix P is predetermined when specific basis functions are selected, and therefore they both are not relevant to the unknown point and they just act as constant in forming shape function. Hence, only the matrix W is defined on , and the shape function is mainly decided by the weighting function.
The basic requirements for weighting function are compact support, nonnegative definite, and continuous and with higher derivatives so as to ensure the uniqueness of the coefficients. The compact support characteristic is the essence for MLS. It is obvious from Figure 1 that a relative large support domain means more nodes are involved in calculation which is approaching the WLS method. While decreasing the support domain, the locality for the MLS will be enhanced, yet the smoothness declines. How to choose an appropriate support radius depends on the fitting errors, smoothness, and the problems' own characteristics.
The commonly used weighting functions include the Gaussian, cubic spline function and compact supported radial basis function (CSRBF). However, we focused on the Gaussian and cubic spline function in this paper. The Gaussian weighting function is where = | − |/ is the relative distance, is the influencing radius, and is shape parameter. Because the weighting function is only defined in the influencing domain, it is a compact support function. In addition, the fitting square error is weighted which just acts as a moving window. Hence, we have (x, x ) = window(norm(x − x )/ ) where the norm can be selected as Euclidean distance. In two-or three-dimensional cases, the distance is norm( There are two adjustment parameters as and in Gaussian function whereas there is only for cubic spline. And, correspondingly, the Gaussian is very flexible for MLS and is adopted in the following discussion. Gaussian and cubic spline functions are shown in Figure 2, and the cubic spline function is amplified by 1.5 in order to facilitate the comparison. Numerical tests show that the Gaussian function is similar to cubic spline when = 2.4.
Consequently, we can conclude the following in MLS.
(1) For basis functions selection, the linear, quadratic, or higher order polynomials are the candidates. As polynomials order increases, better smoothness fitting is obtained. However, the computation cost will significantly increase and even lead to ill-conditioned problems. Therefore, in two-or three-dimensional cases, only lower order polynomials are preferred.
(2) For parameter setting in Gaussian weighting function, the influencing radius is the key issue. The larger radius means better fitting smoothness, yet with more computation cost. And, also, the larger shape parameter means the locality is enhanced while smoothness declines.

Numerical Example
Two numerical examples are carried out to investigate the fitting performance of MLS. One is a periodic function and the other is the famous test function in Runge phenomenon.
The white noise with SNR = 20 dB is added to the above functions. The maximum of noise is about 0.2216 and 0.1264 in the above two cases. The original functions and corresponding noisy data are shown in Figure 3. (2) For the second fitting, only is changed to = 30ℎ. The comparisons of curve fitting are shown in Figure 4.
It can be seen obviously that the local approximation scheme of MLS can acquire much better results than LS method. The MLS fitting curve can follow the changes of the original function even with low order basis function, while, for the global approximation scheme like LS, the oscillation phenomenon occurs and the approximation error increases dramatically. Here, we defined the relative root mean square error (RRMSE) as The numerical results reveal that the maximum error (MAE) and RRMSE in the first fitting are

Measurement Data Fitting
In this section, the electric field intensity E and magnetic flux density B of a 500 kV substation were measured. The measurement points are uniformly distributed in the domain of 125 m × 50 m with interval ℎ = 5m. So the total measurement points are 26 × 11 = 286. The schematic diagram of points' distribution is shown in Figure 5.
The corresponding measurement data of E and B are shown in Tables 2 and 3.
Based on measurement data of Tables 2 and 3, the surfaces of E and B over the measurement domain are constructed by MLS. Then, for a specific measurement line, the MLS for curve fitting is implemented.

MLS Approximation for Surface Construction.
Firstly, the surfaces and contours of E and B are drawn in Figure 6.  The following can be seen from figures. (1) The electric field intensity varies very strongly compared to the magnetic flux density. The reason is that the electric field intensity is affected significantly by the substation equipment whereas it is less affected for magnetic flux density. So field quantity E owns sharp variation characteristics. (2) The surfaces and contours are constructed by linear interpolation. Thereby, the surfaces have relative steep changes, and the corresponding contours have poor smoothness. However, the real electromagnetic field distribution is actually continuous and smooth.
According to the physical law of electromagnetic field distribution, the following considerations on the parameters setting can be concluded. In the E surface fitting, in order to follow the rapid changes in electric field, a small influencing radius and a larger shape parameter are preferred. Hence, the smaller fitting errors are obtained at the expense of smoothness. But for B surface fitting, the radius can be increased and the shape parameter can be decreased. Therefore, a smoother fitting surface can be formed.     fitting. The fitting surfaces and contours of MLS with linear basis functions are shown in Figure 7.
It is obvious that the surfaces and contours get smoother after fitting. The numerical results of MAE, maximum relative error (MRE), and RRMSE are shown in Table 4.
Therefore, the quadric basis functions can acquire more accurate approximation than the linear type. The time consuming for linear and quadric basis functions is 780 ms and 950 ms, respectively.

MLS Approximation for Curve
Fitting. Then, we focused on the curve fitting for specific line measurement data. The magnetic flux density on the line = 25 m is selected which is corresponding to the seventh column in Table 3.
Parameter Settings. Choosing the test points' interval ℎ = 1 m: the quadric basis function is adopted in MLS approximation. The influencing radius and shape parameter have the following combinations. In Figure 8 = 3 is fixed and the radius varied, while, in Figure 8(b), the radius = 3ℎ is fixed and the shape parameter varied. From Figure 8, we can conclude that (1) larger radius means smoother fitting but with larger fitting errors; (2) larger shape parameter means the ability of following rapid changes is enhanced and smoothness declines; (3) the effect of influencing radius is obvious compared to that of shape parameter. However, the fitting can be easily adjusted by setting the Gaussian function parameters.

Conclusions
The MLS approximation method for measurement data fitting was proposed in this paper. Numerical examples and measurement data fitting reveal the superior performance of MLS. The following conclusions can be made.
Firstly, the MLS can be regarded as a combination of WLS and SLS. The essences of MLS are the concept of moving window and compact support weighting functions. Compared to SLS, it realizes soft segment which avoids the fitting discontinuity problems and the fitting smoothness is guaranteed, while, compared to WLS, only the nodes that located in the support domain are involved for coefficients calculation; hence the locality is enhanced and can follow the rapid changes.
Then, the MLS approximation can acquire higher precision even with low order basis functions (e.g., linear basis). And also, MLS is stable for complex fittings because of its local approximation scheme, while oscillation phenomenon occurs for high order polynomials LS fitting.
Finally, there are weighting function parameters as influence radius and shape parameter which means Mathematical Problems in Engineering the fitting can be easily adjusted by tuning above parameters. The MLS method is much more flexible than traditional LS based methods. So the MLS is a promising method for measurement data processing.