Derivative-Free Observability Analysis for Sensor Placement Optimization of Bioinspired Flexible Flapping Wing System

Observability analysis of a bioinspired flexible flapping wing system provides a measure of how well the states of flexible flapping wing micro-aerial vehicles can be estimated from real-time measurements during high-speed flight. However, the traditional observability analysis approaches have trouble in terms of lack of quantitative analysis index, high computational complexity, low accuracy, and unavailability in stochastic systems with memory, including bioinspired flexible flapping wing systems. Therefore, a novel derivative-free observability analysis method is proposed here based on the generalized polynomial chaos expansion. By formulating a surrogate model to represent the relationship between the cumulative measurement and the random initial state, the observability coefficient matrix is calculated and the observability rank condition is stated. Consequently, several observability indices are proposed to quantity the observability of the system. Altogether, the proposed method avoids the disadvantages of the traditional approaches, especially in assessing the observability degree of each state and the effect of stochastic noise on observability. The validation of the proposed method is first provided by demonstrating the equivalence between the traditional and proposed methods and subsequently by comparing the observability of the Lorenz system calculated via three different approaches. Finally, the proposed method is applied on a bioinspired flexible wing system to optimize the placement of sensors, which is consistent with the natural configuration of campaniform sensilla on the wing of the hawkmoth.


Introduction
Due to the high maneuverability and portable structure of birds and insects, bioinspired flexible flapping wing micro-aerial vehicles (FWMAVs) have attracted considerable attention in the last decade [1][2][3]. A prerequisite to designing such agile FWMAVs is the simultaneous and accurate estimation of vehicle states, such as position and rotation rates, through the noisy information measured by the sensors on the wing. To solve this state estimation problem, the observability analysis of a bioinspired flexible flapping wing system is necessary in order to evaluate whether the system states can be inferred from the measurements. Thereby, the guidelines for measurement selection, sensor placement, and model optimization can be provided.
For a bioinspired flexible flapping wing system, deformation inevitably happens because of aerodynamic loads and inertial forces, and negatively influences the estimation of rotation rates based on the measurements from sensors on the wing. In nature, insects have sensing mechanisms that enable them to understand their flying states. For example, the strain information of a flying insect is measured and saved by campaniform sensilla on the wing, followed by conversion to action potentials (voltage spikes) in the sensory neurons [4,5]. After the delivery of these neural-encoded spikes to the central nervous system, the rotation rates are detectable. Such sensing and signal processing mechanics ensure insects' fast and accurate sensory feedback and subsequent high agility [6]. Inspired by these biological mechanisms, the neural encoding processing of strain data can be constructed as neural encoding measurement model [7]. Unlike the raw strain measurement model used previously [8], the neural encoding measurement model has strong nonlinearity, the same as the flexible wing flapping dynamics model. In addition, the measurement at each time contains the current and previous state information. Altogether, the strong nonlinearity and memory function of the flexible flapping wing system make its observability analysis a significant challenge.
For a linear time-invariant system, the traditional observability rank condition is the simplest and most effective criterion to analyze whether the system is observable or not [9]. However, it fails in nonlinear systems, and even in linear time-variant systems. Hence, several observability analysis approaches for nonlinear systems have been developed. Rouhani et al. [10] applied the Lie-derivative-based observability analysis method to power systems with the realistic synchronous generator model, and Seo et al. [11] used the same method to analyze the observability of a missile interception system with line-of-sight angle measurement. This method is feasible only for simple and small-scale nonlinear systems, as it requires considerable derivation calculations. The empirical observability Gramian method, which is developed from the observability Gramian method through interval approximation, is more prevalent in practical applications because it does not depend explicitly on the system models and reduces the computational complexity [12]. For instance, Hinson et al. [8] utilized this method to determine the optimal sensor placement on the wing of the hawkmoth. Hodzic et al. [13] and Hinson et al. [14] respectively applied the empirical observability Gramian method to the sensor placement problem for generic wide-body aircraft and the path planning problem for under-sensed vehicles. However, the existing approaches are either derivative-based, which leads to high computational complexity, or approximation-based, which may reduce the analytical accuracy. Furthermore, these approaches are unable to measure the influence of stochastic noise on observability.
Recently, a derivative-free approach based on the generalized Polynomial Chaos (gPC) expansion has been proposed by Zheng et al. [15] to address the aforementioned problems. They further applied the derivative-free approach to a power system using the stochastic dynamic model [16]. While this method has been proven feasible and computationally efficient for nonlinear systems without control input and memory, it is impracticable for systems with memory, such as a flexible flapping wing system.
In this paper, we propose a modified gPC-based observability analysis approach for both linear and nonlinear systems incorporating memory and applying it to the analysis of a flexible flapping wing system. The observability indices obtained by the proposed approach are used to determine the optimal placement of sensors configured on the wing. The main contributions are as follows.
(1) The traditional observability analysis approaches are extended to linear and nonlinear deterministic systems with memory. By extending the definition of observability to deterministic systems with memory, a new relationship between the cumulative measurement and the initial state is formulated. Then, according to the implicit function theorem, the traditional observability rank condition for systems with memory is provided.
(2) A modified derivative-free approach based on the generalized Polynomial Chaos expansion for linear and nonlinear stochastic systems with memory is proposed, significantly reducing the computational cost and resolving the stochasticity of the system. Because the definition of observability is extended to stochastic systems with memory, it is necessary to represent this new relationship through a surrogate model. Thus, a different mapping between the stochastic input variable and standard normally distributed variable is formulated, resulting in a more appropriate surrogate model. Based on this model, the observability rank condition can subsequently be provided and its equivalence with the traditional approaches proven mathematically.
(3) Based on [15], several different observability indices, such as the first contribution rate and interference binary value, are proposed to describe the observability degree of systems, including the observability of each system state and the effect of measurement noise on the system observability.
(4) Finally, the proposed method is applied to observability analysis of a flexible flapping wing model inspired by the hawkmoth. Based on the proposed observability indices, the optimal sensor placement on the bioinspired wing is discussed and compared with the natural configuration of campaniform sensilla on the wing of the hawkmoth.
The remainder of the work is organized as follows. Section 2 formulates the flexible wing flapping dynamics model and neural encoding measurement model. Section 3 extends the traditional observability analysis approaches to linear and nonlinear systems with memory and discusses the shortcomings of the traditional approaches. Section 4 presents a derivative-free observability analysis approach and the observability indices for the linear and nonlinear system with memory, followed by the equivalence between the traditional and proposed approaches. Section 5 applies the proposed approach to the Lorenz system with memory and the bioinspired flexible flapping wing system. Section 6 discusses the optimal sensor placement based on the observability analysis. Finally, our conclusions are provided in Section 7.

System Model
This paper mainly focuses on the observability analysis problem of the bioinspired flexible flapping wing model based on neural encoded strain measurements. In this section, inspired by the North American hawkmoth, Manduca sexta, a low-order model of flexible wing flapping dynamics is first derived, followed by a neural encoding model of strain measurement.

Flexible Wing Flapping Dynamics
Here, the flexible flapping wing is considered as a thin and flexible cantilevered plate A in a rotating coordinate system, as depicted in Figure 1. This coordinate system is called the wing body frame, where x p are the positive axis points from the leading edge to the trailing edge along the wing root, the positive axis y p is perpendicular to x p and points from root to tip in the wing plane, and the positive axis z p is perpendicular to the wing plane. The cantilevered plate is assumed to deform out-of-plane without in-plane stretching or extension. Hence, the out-of-plane plate deformation w(x, y, t) is described by a finite number of orthonormal spatial modes, that is, where ϕ i (x, y) are the free-vibration mode shapes, η i (t) are the modal coordinates, and n m is the number of chosen modes used to represent the spatial deformation.
Here, two main wing mode shapes, i.e., the first bending mode and the first torsion mode, are chosen to capture the principle wing deformations [8], as illustrated in Figure 2. We define the unit vectors in each axis direction as i p , j p , and k p , the position of a mass element dA on the plate in the wing body frame is r(x, y, t) = xi p + yj p + w(x, y, t)k p (2) and the velocity of dA is provided by where v 0 = Ui p + V j p + Wk p is the velocity of the origin of wing body frame and ω 0 = Pi p + Qj p + Rk p is the angular velocity of wing body frame. We define the mass density of the wing as ρ(x, y), the thickness as h(x, y), the kinetic energy as T e , and the potential energy U e of the wing A as follows: where M is the matrix of the material constants and Λ is the strain vector: Because the generalized coordinates describing the structural configuration are modal coordinates η, Lagrange's equation is formulated as where Q i are the exogenous non-conservative generalized forces. Substituting Equations (1), (3), and (4) into Lagrange's equation, the equations of motion for the flexible wing in the wing body frame is where the modal coordinate vector is η = [η 1 η 2 ] T , the total aerodynamic force is Q = [Q 1 Q 2 ] T , and the stiff matrix Ω, applied acceleration mass matrix M a , and Coriolis force C a are provided by Equations (8), (9), and (10), respectively: where ω i = 2π f i and f i denote the corresponding mode frequency of the ith mode shape.
Let the position of the feathering rotation axis relative to the origin of the wing body frame be r r = x r i p + 0j p + 0k p ; then, the velocity and acceleration of wing body frame are computed by Substituting Equation (11) into (7), the motion equation can be rewritten as The aerodynamics force Q is modeled as the aerodynamics model provided in [8], that is, where Q t0 and Q tη denote the translational generalized force vector and translational force stiffness matrix, respectively, and Q a0 , Q aη , and Q aη represent the added mass force vector, added mass damping matrix, and added mass acceleration matrix, respectively. The detailed equations and corresponding derivations are omitted because the aerodynamics model is not the focus of this work. Let the state vector be x = [ηη P Q R] T and the control input vector be u = [ṖQṘ] T ; then, the flexible wing flapping dynamics model is formulated by substituting Equation (13) into (12): Define the feathering angle as α, the elevation angle as θ, and the position angle as ζ, as shown in Figure 3; these three Euler angles represent the motion of the wing body frame with respect to the inertial frame.  Assuming that the 3-1-2 rotation sequence is used, ω 0 and the Euler angles have the following relationship: whereθ,α, andζ denote the feathering, elevation, and position angular velocity, respectively. The control input u can be computed by taking the derivative of Equation (15) with respect to time t.

Neural Encoding Measurement Model
Assuming that a strain sensor on the wing plane is located at where xx , yy , and xy mean the chord-wise bending strain, span-wise bending strain, and shear strain, respectively. Because the assumed structural modes do not have chord-wise bending, xx is effectively zero, and only yy and xy are assumed to be measured by the sensors on the wing.
To determine the rotation rates, flying insects such as the hawkmoth Manduca sexta deliver the strain data from the campaniform sensilla on the wing to the central nervous system via sensory neurons, where the strain data are converted into action potentials (voltage spikes). This transformation process is called neural encoding. Inspired by this neural encoding mechanism, we constructed a neural encoding measurement model instead of using unprocessed strain measurements (16).
Several experiments have verified that the neural encoding model of hawkmoth wings is based on the two main functions [6,17], namely, the spike-triggered average (STA) and a nonlinear activation (NLA) functions.
The STA function is a measure that relates continuous strain stimulus to the spike, which represents the average stimuli taken during spike occurrences. This is approximated as an exponentially decaying sinusoidal function with a delay a where b is the width and f STA is the STA frequency.
The firing rate of a neuron κ(x s , y s , t) can be estimated by convolution of the strain stimulus and the STA: where C κ is a normalization constant and t M is the memory length.
Furthermore, a saturation function is added to properly reflect the neuron's nonlinear behaviour. Hence, by substituting κ(x s , y s , t) into the STA function, the probability of firing P f ire (x s , y s , t), which implies the probability of firing an action potential at the coordinate (x s , y s ) on the wing, is provided by where c is the slope, d represents the half-maximum position of the NLA function, P f ire (x s , y s , t) is regarded as the neural encoding strain measurement, and the neural encoding measurement model is provided by Equation (19).

Traditional Observability Analysis for Deterministic System with Memory
In this section, the traditional deterministic observability analysis methods are extended to both linear and nonlinear systems with memory; the limitations of the existing methods are then discussed.

Linear System with Memory
Consider the following general linear discrete-time time-invariant system with memory: where x k ∈ R n×1 , u k ∈ R n u ×1 , and y k ∈ R m×1 are the state, control input, and measurement vector at time k, respectively. Here, N is the memory length, which implies that y k explicitly hinges on the information of states from time (k − N) to time k and that the measurement information can be obtained if and only if k ≥ N. Hence, the definition of observability can be extended to the discrete-time dynamics system with memory (20) as follows: The observability rank condition is determined by the following theorem:

Theorem 1. System (20) is (locally) observable if and only if the observability matrix
is a full column matrix whereC is defined as Proof of Theorem 1. Define the cumulative measurement vector Y k ∈ R mn×1 as Substituting Equation (20) into Equation (23), the relationship between the arbitrary initial state x k−N and its corresponding measurements Y k is provided as where the (i, j) element of the feedthrough matrix D ∈ R N×(n−1) is According to the implicit function theorem [18], the initial state x k−N can be uniquely determined from measurements Y k if and only if the Jacobian matrix is a full column matrix.
The Gramian observability method provides an equivalent observability condition: the system (20)

is (locally) observable if and only if the observability Gramian matrix
is nonsingular. These observability rank conditions make the observability analysis of a linear system simple and efficient. However, observability analysis become a significant challenge with regard to nonlinear systems and even to linear time-varying systems.

Nonlinear System with Memory
Now, consider a general continuous-time nonlinear system with memorẏ where x(t) ∈ R n×1 , u(t) ∈ R n u ×1 and y(t) ∈ R m×1 are the state, control input, and measurement vector at time t(t ≥ N), respectively, d i = iD t and D t is regarded as the time step, and f and h are vector-valued functions. The definition of observability of the continuous-time dynamic system with memory (28) is then as follows.
According to Equation (28a), there obviously exists a function between x(t − τ), τ = d 0 , d 1 , · · · , d N and x(t − d N ); hence, the measurement (28b) can be rewritten as whereū(t) is a combination of known control inputs u from ]. For simplicity of notation, we writē h(x(t − d N )) instead of Equation (29).
In this case, the observability rank condition is declared by the following theorem.

Theorem 2. System (28) is (locally) observable if and only if the observability matrix
is a full column matrix in which the Lie derivative is defined by According to the implicit function theorem [18], the initial state With the chain rule, it is simple to obtain Hence, the system is locally observable if condition (30) holds.
This differential geometric method provides a derivative-based analytical observability analysis approach for nonlinear systems called Lie derivative-based observability analysis. However, it usually encounters computational difficulties when solving the higher-order Lie derivatives of complex nonlinear systems, which makes it impracticable in real applications.
In analytically intractable cases [13], the most widely-used approach is the empirical observability Gramian approach [12], which provides a numerical way to approximate the traditional observability Gramian (27) by adding small perturbations in each initial state and comparing the output for each perturbation.
Define y +i as the output with the ith nominal initial state x 0,i affected by a positive disturbance and let y −i be the output with x 0,i affected by a negative disturbance − . The change in the measurement caused by perturbations in each initial state is denoted as ∆y i = y +i − y −i , and the empirical observability Gramian can be computed bỹ where r is the number of states of interest, which implies that the empirical observability Gramian is computed by simulating the system 2r times in total.

Limitations of Traditional Observability Analysis
Although these traditional methods are effective at providing a binary answer to the observability question, they have disadvantages which limit their practicality.
First, due to lack of a unified assessment metric, different systems correspond to different observability rank conditions, leading to confusion in the understanding and use of observability analysis. Second, because multiple derivative calculations are generally required in the analytical method for nonlinear systems, applying them to complex models, such as our bioinspired flexible wing model, is impractical. Furthermore, the traditional methods fail to precisely quantify each state's observability. However, in observability analysis it is crucial to determine which states are observable and which are not. Finally, the existing methods are formulated in a deterministic framework, and hence, are not able to assess the observability of stochastic systems.
Therefore, a derivative-free observability analysis method is proposed here to overcome the above weaknesses. It is able to remarkably reduce the computational burden, analyze the observability degree of each state, and evaluate the effect of noise on observability.

gPC-Based Observability Analysis for Stochastic System with Memory
In this section, based on a brief review of the gPC expansion, the surrogate model of cumulative measurement is formulated, then the observability-coefficient matrix is provided for qualitative analysis of observability. Consequently, observability indices are proposed to quantify the observability of the system. Finally, the equivalence between the traditional and gPC-based methods for linear systems with memory is proven.

The Generalized Polynomial Chaos Expansion
The generalized Polynomial Chaos expansion is an efficient uncertainty propagation method that represents the stochastic output with a weighted sum of orthogonal polynomial chaos basis functions of random input variables.
Let y and ξ = ξ 1 ξ 2 · · · ξ n denote the output and random input variables, respectively, following a known probability distribution. The stochastic output can be expressed as where φ i is a polynomial chaos basis function, γ i is the ith polynomial chaos coefficient, n p = (n+p)! n!p! − 1, and p is the maximum order of the polynomial chaos basis functions. The mean µ and variance σ 2 of output y can be directly obtained as In general, higher orders yield higher accuracy. However, the number of unknown coefficients and the computational burden increase with the order. Many tests have proven that the increase in order has a negligible effect on the accuracy improvement when the order is larger than 2 [19]. Hence, the second order truncated gPC expansion is adopted in this paper, which is where φ 0 , φ 1 (ξ i ), and φ 2 (ξ 2 i ) denote the zeroth-order, first-order, and second-order polynomial chaos bases, respectively, and γ 0 , γ i , and γ i,i represent the corresponding polynomial chaos coefficients. Note that only 2n + 1 polynomial chaos coefficients need to be determined.
Assuming that the random variable ξ i follows a standard normal distribution, the corresponding polynomial chaos bases are as follows [19]:

Observability Rank Condition
Consider a general nonlinear stochastic system with memory (28), where x = [x 1 x 2 · · · x n ] and the ith state random variable x i follows the known distribution.
Distinct from [15], the definition of observability of stochastic systems with memory is extended as follows.
and its solution satisfies a 95% confidence interval.
In order to resolve probabilistic uncertainty propagation in such a system, a surrogate model is formulated by the following steps to represent the above relationship between the random initial state x(t − d N ) and its corresponding cumulative measurement vector Y(t) (32).
First, we determine the mapping relationship between the ith element of the stochastic input variable x(t − d N ) and a random variable ξ i following a standard normal distribution, which is where F i is the cumulative probability function of is the inverse function of F i , and T i denotes the cumulative probability function of ξ i .
Next, collocations points (CPs) are selected to construct the surrogate model. CPs are a finite sample set of ξ, and the ith combination of CPs is expressed as The element values of the CPs are generated by the roots of one higher-order one-dimensional Hermite polynomial [19]. For example, three roots of the third order Hermite polynomial , are used to to comprise the CPs, as a second order polynomial chaos expansion is adopted in this paper. Because there are 2n + 1 unknown polynomial chaos coefficients, 2n + 1 independent combinations of CPs are chosen randomly from the 3 n possible combinations, which results in the matrix Ξ ∈ R (2n+1)×n , as follows: which is the full rank where the value of the ith element of the sth CP ξ s,i is chosen randomly from {− √ 3, 0, √ 3}. Then, 2n + 1 samples of stochastic input variables are transformed from 2n + 1 CPs based on Equation (40). Substituting them into Equation (32) in place of the original input variables T and Y i represents the measurement output from the ith sample.
Consequently, according to Equation (38), the surrogate model is provided by where the basis matrix of polynomial chaos bases H ∈ R (2n+1)×(2n+1) is provided by Equation (43) and the coefficient matrix of polynomial chaos coefficients Γ(t) ∈ R (2n+1)×mn is Equation (44); here, γ l 0 , γ l i , and γ l i,i represent the polynomial chaos coefficients with respect to the ith state and lth measurement: Because Ξ is full rank, it is obvious that H is nonsingular and its inverse matrix H −1 exists. Hence, the unknown polynomial chaos coefficients can be obtained by According to Equation (37) and the orthogonal property [20], the zero-order polynomial chaos coefficient γ l 0 denotes the mean of the estimated value for the lth measurement and the first and second order polynomial chaos coefficients γ l i and γ l i,i represent the contribution of the ith state to the uncertainty of the lth measurement. Supposing that the contribution of the ith state to the uncertainty of the lth measurement is zero, the lth measurement is unaffected by the change in this state, which implies that the ith state cannot be uniquely determined from the lth measurement. In order to uniquely infer n states from the given measurements, n valid measurements, for which the contributions of the states to the uncertainties of the estimated values for these measurements are linearly independent, are necessary. Therefore, we define the observability coefficient matrix Φ(t) ∈ R 2n×mn as follows: and the observability rank condition is stated by the following theorem. Note that by using a surrogate model to represent Y k in Equation (23), the proposed gPC-based observability analysis method can solve the observability problem of linear and nonlinear discrete-time systems with memory.
The detailed gPC-based observability analysis procedure is summarized in Algorithm 1.
Algorithm 1 gPC-based Observability Analysis Procedure 1: Determine the mapping between ith random variable x i (t − d N ) and a normal variable ξ i via Equation (40); 2: Select CPs (41) based on the linear independence method and substitute them into basis matrix (43); 3: Transform all CPs into the samples of stochastic input variables based on the mapping (40); 4: Compute output matrix Y(t); 5: Calculate the coefficient matrix (45) and the observability-coefficient matrix Φ(t); 6: Analyze Observability according to the observability rank condition Theorem 3.

Degree of Observability
The observability rank condition can only draw a binary conclusion as to whether the system is observable. However, it is limited to quantifying the observability of the system. Hence, three more quantitative observability indices are proposed to further analyze the observability degree.

1.
Condition Number: The condition number κ(Φ) is the ratio of the maximum singular value to the minimum singular value, which is utilized to show the numerical stability of the system states, and is provided by where σ max (Φ) and σ min (Φ) are the maximal and minimal singular values of Φ, respectively. Suppose that the condition number is enormous or even goes to infinity, the observabilitycoefficient matrix Φ is ill-conditioned, and the system is weakly observable; this implies that certain states are hard to observe. However, if the condition number is close to one, Φ is well-conditioned and the system is brawny observable. Note that all system states are considered equally observable when the condition number equals one.

2.
Contribution Rate: Two different equations for the contribution rate are provided in this paper, both of which are regarded as quantitative indices of each state's observability. The first contribution rate, χ 1 i , is defined as the contribution of the ith state to the uncertainty of all measurements. According to the surrogate model, it is provided by which represents the influence of a specific state on the measurements. The ith state is brawnier observable when its first contribution rate χ 1 i is closer to one. Instead, the ith state is weakly observable as χ 1 i approaches zero. The second contribution rate, χ 2 i , is the maximum contribution of the ith state to each measurement. We define the proportion of the contribution of the ith state to the variance of the lth measurement as χ 2 i,l , that is, where the numerator means the contribution of the ith state to the variance of the lth measurement and the denominator denotes the variance of the lth measurement. Hence, χ 2 i equals the maximum of (χ 2 i,1 , χ 2 i,2 , · · · , χ 2 i,mn ). As in the first contribution rate, the larger the second contribution rate is, the more the state is brawnier observable.

3.
Interference Rate: If the contribution of the ith state to the variance of the lth measurement, (γ l i ) 2 + (γ l i,i ) 2 , is smaller than the measurement noise variance σ 2 v , the changes in measurements contain too much environmental interference, and the initial state is difficult to distinguish from noisy measurements with a high confidence level. Therefore, we define the proportion of the measurement noise variance σ 2 v to the variance of the lth measurement as the interference rate: If the interference rates V 1 , V 2 , · · · , V mn are larger than all the corresponding contribution of any states χ 2 i,1 , χ 2 i,2 , · · · , χ 2 i,mn , the system is considered to be weakly observable due to noisy measurements.
To simplification simulation, an equivalent index called the interference binary value Υ is used: When Υ equals zero, the measurement noise has negligible effect on observability analysis. Inversely, the states are hard to infer from noisy measurements when Υ equals one.

Equivalence between the Traditional and Proposed Approaches
To further clarify the rationality of the proposed method from another perspective, the connection between the traditional and proposed methods for a general linear system with memory (20) is demonstrated as a particular case.
For a general linear system with memory (20), the relationship between the random initial state x k−N and the cumulative measurement Y k at time k is provided by Equation (24). We define ∆x k−N ∈ R n×1 and ∆Y k ∈ R m×1 as the state and measurement uncertainty vectors, respectively; as the control input vectors u from time k − N to k − 1 are determined at time k, the uncertainty propagation function is where O is provided by Equation (21). Assuming that there exists an open neighborhood U of x k−N and that x k−N + ∆x k−N ∈ U, we can find that x k−N and x k−N + ∆x k−N are distinguishable from their corresponding measurements if and only if the observability matrix O has full column ranking based on Theorem 4, which implies that system (20) is locally observable at time k.

Theorem 4. Consider a non-homogeneous linear system of equations as
where A ∈ R m×n , x ∈ R n×1 , and b ∈ R m×1 . Then, there exists a unique solution if and only if the rank of the coefficient matrix A is n.
Taking n samples of stochastic input variables into consideration, the above equation can be rewritten as where ∆x i k represents the measurement and state uncertainty vector from ith samples at time k.
In the proposed approach, the surrogate model of the relationship between x k−N and Y k is expressed as Because the second-order polynomial chaos coefficients are zeros for a linear system, the surrogate model is simplified as As mentioned above, γ l 0 is the mean of the lth measurement and γ l i stands for the contribution of the ith state to the uncertainty of the lth measurement. Hence, System (20) is locally observable if and only if rank(Φ) = n. The same observability rank condition for linear systems with memory are derived from the traditional and proposed method. This convincingly proves that gPC-based observability analysis is equivalent to the traditional method.

Simulations
In this section, the observability of a Lorenz system with memory is first analyzed by the traditional and proposed methods to validate the feasibility of gPC-based observability analysis. Then, we apply the proposed method to observability analysis of a bioinspired flapping wing system based on the hawkmoth, Manduca sexta.

Lorenz System with Memory
Consider the following Lorenz system with memory: with starting time t 0 = 0s, final time t f = 10s, time step dt = 0.01s, and initial state

Lie Derivative-Based Observability Analysis
The observability analysis is first performed by using the Lie derivative-based approach. The observability matrix O(t) is calculated by Equation (32), and its rank is shown in Table 1. In addition, the condition number of O(t) is shown in Figure 4 to measure the observability degree.   It can be seen that the system is observable, as the observability matrix is full rank and the value of the condition number changes drastically and reaches large values at intervals, revealing that the system is weakly observable. However, this approach can neither quantify the degree of observability for each state nor account for the effect of the observation noise, thereby reducing its reliability in practice.

Empirical Observability Gramian Analysis
Empirical observability Gramian is the most widely used method in practical applications due to its avoidance of the need to calculate the complicated Lie derivatives of nonlinear systems. The rank of the observability matrixW o (t) computed by Equation (35) is shown in Table 1, and the condition number is present in Figure 5. The same conclusion that the system is weakly observable is drawn via empirical observability Gramian analysis, as the observability matrix maintains full rank while the condition numbers are far from one. However, the condition number is more stable than that computed by the Lie derivative-based approach, most likely due to the inaccuracy of the approximation.

gPC-Based Observability Analysis
Here, the proposed observability analysis approach is utilized. The observability coefficient matrix is computed through Equation (44). In the observability coefficient matrix, the first order polynomial chaos coefficients are larger and more significant than the second order polynomial chaos coefficients [16]; thus, we name the first n rows of the observability coefficient matrix as the first order observability coefficient matrix. The ranks of these two observability matrices are shown in Table 1. It can be seen that both of the observability coefficient matrices are full rank at all times, meaning that the system is observable.
Then, the first and second contribution rates of each state are shown in Figure 6.  It is evident from Figure 6 that the contribution rate of the third state is much lower than that of the first two states and varies periodically with time, which implies that the third state is weakly observable while the others are brawny observable.
This conclusion can be proven by the condition number. The condition number of the first order coefficient matrix is displayed in Figure 7a. It can be seen that it has enormous values and a similar change to the contribution rate of the third state. This is because the weak observability of the third state has a negative impact on the observability of the whole system, thereby resulting in an ill-conditioned matrix. The coefficients of the states with brawny observability extracted from the first-order coefficient matrix constitute the active coefficient matrix. Its condition number is presented in Figure 7b, showing that the condition number of the active coefficient matrix is very close to one. This implies that the active coefficient matrix is well-conditioned and the first two states are brawny observable. Therefore, it can be concluded that the condition number is strongly affected by the weak observability of any state. When the condition number has large values, at least one state of the system is weakly observable.
In addition, the effect of the measurement noise on the observability is shown in Figure 8. Two different noise variances are assumed, 1 × 10 −9 and 1 × 10 −11 . When the noise variance becomes larger, more interference binary values within the simulation time equal one, which implies that the observability of the system is weaker. Finally, the computation complexity of the three approaches is compared by computation time in Table 2. The computation time was computed using MATLAB R2021b on a 2.70 GHz Intel(R) Core(TM) i7 processor with 8 GB RAM. Though Lie derivative-based observability analysis has the shortest time cost in the case where the derivation is completed, it is limited for systems with high nonlinearity in actual application because of the complicated derivative calculation. The proposed method effectively reduces the computational cost compared to empirical observability Gramian analysis.

Bioinspired Flexible Flapping Wing System
Considering the system model as Equation (14) and the measurement model as Equation (19), the proposed observability analysis approach is used to determine whether the neural encoding strain measurements are sufficient to reconstruct the wing rotation rates (P, Q, R). The observability analysis plays a vital role in the optimal placement of sensors on the wing in practice, which is further discussed in the next section.
The simulation of the full bioinspired flexible flapping wing model requires several steps. First, the wing-beat period and the total simulation time are assumed to be T beat and 2T beat , respectively. The time step is set as T beat /50. The first period is used to fill the memory, and the observability analysis is based on the measurements at the second period.
Second, the control input sequence u(t) = [Ṗ(t)Q(t)Ṙ(t)] T is generated by derivation of Equation (15) with respect to time t. According to [21,22], the Euler angles are provided by where A ζ is the position angle amplitude and A α is the feathering angle amplitude. Then, the stiff matrix Ω, applied acceleration mass matrix M a , and aerodynamics force Q are computed using the wing structural mode shapes ϕ i (x, y), their corresponding f i , the mass density ρ(x, y), and the thickness h(x, y). We assume that the mass density of the wing is constant and model the thickness as an exponential decrease from root to tip and from the leading edge (LE) to the trailing edge (TE) [23], that is, where t LE and t RO are the leading edge and the root thickness, respectively, c wing and d wing are the chord and spanwise length, respectively, a LE and a RO are the respective decay rates along the two directions, x LE (y 0 ) means the x-ordinate of the intersection point at the leading edge, and y = y 0 . Finally, bysubstituting these pre-processing data and the detailed parameters listed in Table 3 into Equations (14) and (19), the full bioinspired flexible flapping wing model is constructed and the observability indices are calculated using the gPC-based observability analysis approach. To account for the observability changes on different locations of different sensors, the wing's surface is meshed into a 50 × 22 grid. One shear sensor and one bending sensor are placed at each point of intersection on the wing. Here, the first contribution rate is adopted to describe the observability degree of each state, while the minimum contribution rate provides a measure of the weakest observable state.
The averaged contribution rate of the three wing rotation rates for all sensors is shown in Figure 9. The above illustrates that R is the weakest observable state when only shear or bending strain measurements are obtained, while P and Q are brawnier observable. In addition, shear strain measurements result in brawnier observability of the whole wing model.
On the other hand, bending strain measurements provide the smaller condition number, with a mean value of 52.5629, while the averaged condition number of the shear strain measurements is 87.049, which implies that the observability of all rotation rates are more balanced when using bending strain measurements.
Then, the averaged minimum contribution rate for each sensor location and type within the simulation time is obtained and normalized by the max-min normalization method, depicted in Figure 10. This indicates that the rotation rates can be accurately estimated when bending strain sensors are concentrated in the wing root and shear strain sensors are placed in the upper part of the trailing edge, as because the bending strain at the wing root and shear strain at the upper part of the trailing edge are the largest and contain more information about the rotation rates. In addition, bending strain sensors located in the wing root provide more measurements to encode the rotation rate compared to the shear strain sensors at their best location.
Consequently, we chose five typical locations, namely, the root, the tip, the middle of the leading edge, the middle of the trailing edge, and the center of the wing, to show the changes in observability degree during the simulation time. The minimum contribution rates of the rotation rates for the two types of sensors are shown in Figures 11 and 12. It can be seen that the bending strain sensor at the wing root results in the brawniest observability, while the shear strain sensor at the same place leads to the opposite result. For shear strain sensors, similar observability degrees can be achieved from the other four locations; in particular, the sensors at the tip and the middle of the trailing edge are capable of obtaining the most valuable measurements. However, the effective bending measurements are mainly obtained from the sensor at the root. This result is the same as that demonstrated in Figure 10.
The condition numbers of the rotation rates for each sensor location and type are shown in Figures 13 and 14. It can be seen that the condition number for each sensor location and type varies dramatically over time. The observability of the states is primarily more balanced when the shear strain sensors are located at the root and the bending strain sensors are located at the middle of the trailing edge.  When the sensors are assumed to be inaccurate, the noise variances of the shear and bending strain sensors are 1 × 10 −18 and 1 × 10 −19 , respectively; the interference binary values from noisy measurements are shown in Figures 15 and 16.
The figures reveal that the observability based on the bending strain measurements is more sensitive to measurement noise than that based on noisy shear strain measurements. Furthermore, for sensors of the same type in different locations, the same measurement noise shows a different effect on the observability. This is because the same sensors at different locations encode different information about the wing rotation rates.
These observability indices provide the main metrics for optimizing the placement of sensors, which is discussed in the next section.  Figure 16. Interference binary values for bending strain sensors located in different places.

Observability-Based Optimal Sensor Placement
Here, all sensors are assumed to be located at the wing veins, as this is more consistent with the characteristics of the hawkmoth [24]. The optimal sensor problem is to find the set of sensors that can encode the most information about wing rotation rates based on the proposed observability indices when the possible location and type are given.
As mentioned in Section 4.3, the observability degrees of the rotation rates are more balanced when the condition number is smaller, and the system becomes more observable as the minimum contribution rate becomes larger. In addition, only when the interference binary value equals zero can the negative effect of measurement noise on observability be neglected. Thus, we define the observability-based criterion for the ith sensor as J i , which is where the normalized condition number of the ith sensor is denoted as κ i , χ 1 min,i stands for the minimum contribution rate of the ith sensor, the max-min normalization function is (x) = (max − x)/(max − min), Υ i is the interference binary value of the ith sensor, ω and ω Υ are the weights, and J i shows the ith sensor's ability to encode information about the wing rotation rates, which increases as J i decreases.
To obtain the optimal sensor placement, a set of possible locations of sensors is first determined by sampling the points at every 2 mm along each vein. Then, the observabilitybased optimal sensor placement problem can be modeled as where β i is a binary activation function, analogous to an off/on switch, and the number of potential sensors in the set p = 336, r is the desired number of sensors for placement on the wing. Based on the convex optimization problem and the traversal method, r optimal locations out of all potential places on the wing veins are obtained at each time step. The optimal locations change with flexible wing motion and external noise during flight, and thus each possible point's cumulative number for being an optimal location is counted. A larger cumulative number indicates that a strain sensor placed here is more conducive to improving the observability of the flexible wing flapping system by following the estimation accuracy improvement of rotation rates. The areas where more optimal locations are clustered suggest the most suitable places to arrange the strain sensors.
We assume that the sensors are inaccurate and that measurements inevitably contain noise, as sensors are usually imprecise in practical applications due to technical or external environmental reasons. The noise variances of the shear and bending strain measurements are set as 1 × 10 −18 and 1 × 10 −19 , respectively. Let ω be 5, ω Υ be 100, and r be 20; then, each possible location's cumulative number for being an optimal location during the simulation is plotted in Figure 17 (when over 5). Cumulative Number Figure 17. Cumulative numbers for being the optimal location when measurement noise variance is large: ω = 5, ω Υ = 100, and r = 20.
The figure shows that the optimal locations for strain sensors on the wing are divided into three groups: one near the root, one in the center, and one on the upper part of the trailing edge. The wing root is the best location, followed by the upper part of the trailing edge, then the center.
When the weight of the minimum contribution rate ω is reduced to 1, the numerical stability of the states becomes more critical. The cumulative number for each possible location to be optimal in this case is shown in Figure 18. Obviously, more optimal locations are concentrated at the wing root, while the number at the other locations decreases. With r = 30 the numbers for all three groups are increased, as illustrated in Figure 19. Cumulative Number Figure 19. Cumulative numbers for being the optimal location when measurement noise variance is large: ω = 5, ω Υ = 100, and r = 30.
When the noise variance of the shear and bending strain measurements diminishes to 1 × 10 −19 and 1 × 10 −20 , respectively, the best locations on the wing are those shown in Figure 20. In this situation, the numbers for the best locations at the center and upper part of the wing increase. Finally, process noise with the variance of [0.01 0.01 0.01 0.01 1 1 1] is considered, which is mainly caused by inaccuracy of the dynamic model and unknown control inputs. The best locations on the wing are shown in Figure 21.  The best sensor locations are again clustered into three similar areas, although now most of them are located on the wing root. This is because the observability of the wing system is the brawniest, and the least affected by process noise when the sensors are located at the wing root.
Although the optimal sensor placement varies slightly with the different parameter selection, it remains concentrated in three main areas of the wing: one at the wing root, one in the center, and one on the upper part of the trailing edge, which is consistent with the measured locations of the campaniform sensilla on the hawkmoth wing depicted in Figure 22 [24]. The similar optimal placement we obtained based on the gPC-based observability analysis approach proves its validity and practicality.

Discussion and Conclusions
This paper proposes a derivative-free observability analysis approach based on the generalized Polynomial Chaos expansion for stochastic systems with memory. The observability rank condition provides a binary answer to the observability question, followed by several observability indices to describe the observability degree of the system from different perspectives. For instance, the contribution rate quantifies the observability degree of each state, the condition number presents the numerical stability of all states, and the interference rate measures the influence of measurement noise on the observability. In addition, the equivalence between the traditional and proposed approach for linear systems with memory is proven. The effectiveness of the proposed approach is mathematically demonstrated by applying three different approaches to analysis of the Lorenz system and comparing the results. Sequentially, the proposed approach is utilized to analyze the observability of a flexible wing system and determine the optimal sensor placement. The results show that bending strain sensors should be located at the wing root, while shear strain sensors should be placed at the center and upper part of the wing. The optimal placement we obtained based on the proposed method is similar to the natural distribution of campaniform sensilla on the wing of the hawkmoth.