Modeling nonlinear systems using multiple piecewise linear equations

This paper describes a technique for modeling nonlinear systems using multiple piecewise linear equations. The technique provides a means for linearizing the nonlinear system in such a way as to not limit the large signal behavior of the target system. The nonlinearity in the target system must be able to be represented as a piecewise linear function. A simple third order nonlinear system is used to demonstrate the technique. The behavior of the modeled system is compared to the behavior of the nonlinear system.


Introduction
The technique in this paper uses multiple piecewise linear equations to model nonlinear systems.It provides a means for piecewise linearizing the nonlinear system in such a way as to not limit the large signal behavior of the target system.By doing this, any linear estimation technique may be used to generate an estimate of the internal system states in order to provide a means to use state feedback controls.The modeling technique will be demonstrated on a simple third order nonlinear system.
Many techniques have been used to solve the problem of estimating the states of nonlinear systems.The most basic approach is to linearize the system about an operating point and use standard linear estimation techniques [1].In this case, the first derivative of the nonlinear function, evaluated at a specific operating point, is used to develop a first order set of linear state equations.Other techniques use least squares methods directly to try to minimize the errors in the nonlinear estimation problem [2,3].For special classes of nonlinear estimation problems with linear models excited by white Gaussian noise, explicit estimation results may be obtained by using Gaussian probability density functions.These functions are used to predict the most likely values of the state variables based on the current values of the output and the covariance of the state estimation error [4].Finally, for sampled data systems, much work has been done on using numerical differentiation for state observer design [5,6].This approach uses the derivative of the measurement data to predict certain states that are the derivative of a linear combination of the output variables.This approach suffers from rather noisy signals obtained by computing the derivatives of sampled data.
The technique presented here extends the linearization technique by using piecewise linear models that cover the expected range of the state variables.As such, this method does not limit the large signal behavior of the modeled states.The only restriction is that the nonlinearities must be able to be approximated as piecewise linear functions.
The type of nonlinear systems we are trying to model are of the form: where x(t) ∈ R n and y(t) ∈ R m .The functions, f (x(t), u(t)) and h(x(t), u(t)), are the nonlinear functions of appropriate order.The system is to be modeled as a set of piecewise linear equations of the form: Each of the system's nonlinearities is modeled with a suitable piecewise linear function that covers the dynamic range of the state variables.The piecewise functions must not have any discontinuities.Assuming the nonlinearities were broken up into m individual linear functions, this may result in q individual system, input, output and feed forward matrices (A i , B i , C i , D i ∀i = 1, 2, 3, . . ., q).The boundaries of the piecewise linear functions may be a function of one or more of the state variables.The boundary functions are used to select the appropriate system, input and gain matrices for the system by using a data selector or multiplexer.Thus, the piecewise linear model dynamically switches from one set of system and gain matrices to another as the estimated states traverse through their trajectories.
The example presented in Section 3 illustrates this technique.We will start from a nonlinear set of state equations.Then, a piecewise linear model will be developed.Finally, the simulation results of the piecewise linear modeled system will be compared to the actual nonlinear system.

Piecewise linear modeling
The nonlinearities in the real world can take on many different forms.For instance, the very simple pendulum problem has a state formulation of the form: where c 1 and c 2 are system constants and x 1 and x 2 are the angular position and velocity, respectively.Here the nonlinear function is the sine function.
For this method, a nonlinear function, f (x 1 (t), x 2 (t), . . ., x n (t)), is modeled as a collection of linear functions of the form: The number of linear regions that the nonlinear function is broken up into is represented by q.If the function is non-linear in one state variable, the total number of regions is simply the number of line segments used to represent the function.For example, the function f (x 1 ) = sin(x 1 ) may be broken up into a minimum of 3 line segments in the regions of (0 In this case, q = 3.For a more complicated function f (x 1 , x 2 ) = x 2 1 sin(x 2 ), assuming x 1 and x 2 are broken up into 4 segments each, the maximum number of approximation functions is 32 (4 × 4 × 2 = 32).For this function, the regions become triangular planes instead of lines.The boundaries between the triangular planes are the intersections of adjacent planes, which are obviously lines in space.
In general, the maximum total number of functions required will be equal to the product of the segments into which each of the state variables' range is broken up into times the number of geometric shapes required to cover the region.In mathematical terms, where s i -the number of segments that each state variable involved in the nonlinearity is broken into and g -the geometric multiplier.Typically, the number of approximation functions can be greatly reduced due to symmetries in the nonlinearity.Table 1 shows some common functions, the types of geometric regions, and the geometric multiplier value.There are three basic methods for computing the coefficients m i1 , m i2 , . . ., m in and b i for (3).First, there is multiple regression analysis, where the coefficients in (3) are determined using Gauss's least squares regression applied to multiple variables [7].This method gives the best estimate for each of the regions but suffers from discontinuities at the boundaries of the regions.This can cause issues when using the approximate function for controls or state estimation.
The next method is the multi-variable Taylor series method [8].This method of computing the coefficients uses the constant and linear terms of the multi-variable Taylor series.With this method the function must be differentiable and the center point of each of the regions must be established.This method also suffers from discontinuities at the boundaries.
Lastly, there is the method that comes from the definition of a piecewise linear function.This method, for the purpose of this paper, shall be called the "point-to-point" method.This method uses basic linear algebra to solve for the coefficients in (3).The correct number of points, corresponding to the number of variables in the nonlinear function, are chosen at the verticies of the region boundaries.These points, together with the actual value of the function at these points, are used to compute the solution to the coefficients in (3).The number of points depends on the number of variables in the nonlinear function.For a single variable function, only the starting and end point of each region is needed.For a two variable nonlinear function, three points are needed.This is because three points define the plane for each region.Assuming the region is rectangular, this means each rectangular region will have two triangular planes defining the approximate function within the region.
To illustrate two of these methods, we can look at the nonlinear function in (4).
First, we will look at the regression model.Next, we will look at the "point-to-point" model and contrast the differences.The regions are chosen as rectangular regions in the x 1 and x 2 cartesian plane as follows: This gives 4 regions for x 1 and 6 regions for x 2 for a total of 48 triangular planes, considering 2 triangular planes per rectangular region.A plot of the nonlinear function in (4) over the above regions is given in Fig. 1.Now this can be compared to the plot of the approximate function using the regression model in Fig. 2. As can be seen, there are significant discontinuities between the triangular planar regions at the boundaries.This can cause some real problems if the model is to be used for a linear state estimation or to design a linear controller.
Turning to the "point-to-point" piecewise linear model, we can see in Fig. 3 that there are smooth transitions between the region boundaries.No discontinuities are present in the piecewise linear function itself.There are discontinuities in the first derivative of the function on either side of the boundaries, but this is of no real significance since we are looking for the value of the function, not its derivative.As stated previously, the error with the "point-to-point" piecewise linear model is greater than the multiple regression piecewise linear model within the regions, but there are none of the discontinuities experienced by the regression model.This makes the "point-to-point" model more desirable from a linear estimation and controls perspective.In the next section, we shall look at this piecewise linear modeling technique applied to a simple 3rd order nonlinear system.

Application to a motor driven pendulum
To demonstrate the above technique, a simple motor driven pendulum, used in another of the authors' papers, will be used [9].Piecewise linear modeling of the nonlinearities of of this system will reduce the computational power required to estimate the system states.The system model is shown in Fig. 4.
The equations of motion for this system are given in (6).
where the system parameters are defined as: Now, to facilitate writing state equations, we let x 1 (t) = the pendulum angle, θ(t), x 2 (t) = the pendulum angular velocity, θ(t), and x 3 (t) = the motor current, I a (t).Using specific values for the above system parameters involved in the equations of motion, we get the following nonlinear state equations for the system: The nonlinear term in the ẋ2 (t) equation can be modeled as a set of seven piecewise linear functions of the form −40.69 sin(x 1 (t)) ≈ −40.69(m i x 1 (t) + b i ) ∀i = 1, . . ., 7 over the interval from −π ≤ x 1 (t) ≤ π.The nonlinear system equations become a set of seven piecewise linearized state equations of the form in (7): The piecewise linear system matrices are shown in (8): The values for m i and b i are given in Table 2 and are computed using a linear regression technique.The A 1 , . . ., A 7 and B 1 , . . ., B 7 matrices form the set of system and input matrices for a dynamically switching data selector.For the purposes of determining which set of A i and B i to use within the data selector, the state, x1 (t), is normalized to the range −π ≤ x 1 (t) ≤ π.The nonlinear system and the piecewise linear system were co-simulated.When simulating the piecewise linear system, the correct set of A i and B i matrices are chosen by using a data selector driven by a lookup table based on x1 (t).For example, when x1 (t) is in the range 0.5π ≤ x1 (t) ≤ 0.7π, the lookup table will output a 6 and the data selector will use A 6 and B 6 .This switching is done dynamically so as to minimize the lag introduced into the system.Only the results for x 1 (t) and x1 (t) are presented here to demonstrate the concept.
The system was excited with a 1-second step pulse of sufficient magnitude to force the system through a complete revolution.As can be seen in Fig. 5, the multiple piecewise linear model provides a very good estimate of the nonlinear system's state.The mean error is −0.0245 radians and the standard deviation is 0.181 radians.The effect of some of the errors introduced by the model can be seen in the initial rapid acceleration through one full rotation, where the model over-predicts the position initially, then under predicts the position once the system has reached its maximum travel.The effect of the system integrator can be seen by the phase shift that is introduced between the actual and estimated positions after the 10-second point in the trace.Of course, any type of linear feedback estimation technique may be used to reduce this error.

Conclusions
In this paper, a technique was presented for using multiple piecewise linear models on nonlinear systems in order to estimate the internal states.The only restriction on this method is that the nonlinearities must be able to be expressed as piecewise linear models.In addition, there needs to be a reasonable estimate of the range the state variables will traverse for those state variables that are in nonlinear portions of the state equations.With the resulting model, any type of linear control or estimation optimization technique can be used.In fact, using this method in conjunction with optimal or robust linear estimation methods, like standard predicting Kalman filters or H ∞ estimators, produces excellent estimation results.Of course, different optimization methods for each of the linear regions of the piecewise model may be used if desired.

K 1 Fig. 4 .
Fig. 4. Simple system block diagram of a motor driven pendulum.

Table 1 .
Typical functions and regions.