## 4 Data Trend Term Removal Algorithm
### Implementation of Polynomial Fitting  
Considering the substantial amount of measured wing loading data, if the size of the measured data reaches 2 GB, when the weighted least squares method is used to fit all the data points, the processing efficiency will be very low. To find the trend term function, it is sufficient to use a limited number of data points that accurately represent the trend curve, which is the basis for large-scale processing. Through comparative analysis of the measured data, it can be found that the zero-drift of the test data (mainly the smooth curve) can be derived according to experience that the trend of the curve change can be fitted with higher-order polynomials. The measured zero-drift data curve is shown in Figure 6.  
In the implementation of zero-drift processing, the objective extends beyond merely visually observing the zero-drift trend. It also includes the construction of a comprehensive array of zero-drift trend curves. Therefore, fitting of the zero-drift trend line is a key component of zero-drift treatment. From the set of sample points \((t_{i}^{\prime},\varepsilon_{i}^{\prime})\) to be fitted, the least squares polynomial fitting algorithm is applied to obtain the zero-drift trend curve function. Then, the corresponding point \(t_{i}\) in the original data is substituted into the obtained fitting curve function to obtain the function value \(\varepsilon_{i}^{\prime}\) on the fitting curve. Subsequently, the value \(\varepsilon_{i}\) on the original data time history curve is subtracted from the value of the fitting curve function (i.e., \(\varepsilon_{i}-\varepsilon_{i}^{\prime}\)) to obtain the corrected drift curve. The main process is detailed in Figure 7. the final result will be displayed via the main display interface.  
The measured data value coordinate point is defined as \((t_{i},\varepsilon_{i})\), and the drift value coordinate point on the curve is obtained by fitting a polynomial as \((t_{i}^{\prime},\varepsilon_{i}^{\prime})\). Assuming zero-drift, as shown in Figure 8a, the segment data \(t_{1}\sim t_{2}\) is taken as the processing object, with the polynomial function fitted as follows:  
\[\varepsilon=f(x)=\sum\limits_{i=0}^{m}{a_{i}x^{i}} \tag{25}\]  
Then, the value of the drift quantity at any moment \(t_{i}\) can be found using the above equation, namely, \(\Delta\varepsilon_{i}=\varepsilon_{i}-\varepsilon_{i}^{\prime}\). The correction algorithm for the resulting zero-drift value is as follows:  
\[\left\{\begin{array}{l}\varepsilon=f(t)=\sum\limits_{i=0}^{m}{a_{i}t^{i}}\\ \Delta\varepsilon_{i}=\varepsilon_{i}-\varepsilon_{i}^{\prime}\end{array}\right. \tag{26}\]Figure 8: Polynomial fitting method for trend term removal. The red line in (**a**) represents the trend term curve fitted from the original data using Formula (25), while (**b**) shows the curve obtained by subtracting the trend term value from Formula (27).  
Figure 7: Data processing flowchart.  
The principle of this algorithm is to move the zero-drift trend line to the relative zero-line position, as shown in Figure 8b. If we do not need to move to the absolute zero line but only become parallel to the zero-line (as in Figure 8b), this process is considered complete; however, if we are also moving to the absolute zero of the coordinate system, the following correction is made:  
\[\left\{\begin{array}{l}\varepsilon=f(t)=\sum\limits_{i=0}^{m}a_{i}t^{i}\\ \Delta\varepsilon=\varepsilon_{i}-\varepsilon_{i}^{\prime}-a_{0}\end{array}\right. \tag{27}\]  
This gives rise to two modes, which we call relative zero and absolute zero. The corresponding processing modules were specially designed in the program.