Planes

\[ C_{M_{ CG }} = C_{M_{ wing }} \bar{c} + C_{L} x_{CG} \]

So for a \(C_M\) of 0 at a at a particular \(\alpha\),

\[ x_{CG} = -\frac{ C_{M_{ wing }}(\alpha) \bar{c}}{ C_{L}(\alpha)} \]

Static margin:

The neutral point is located at

\[ x_{NP} = - \bar{c} \frac{\partial C_M / \partial \alpha} {\partial C_L / \partial \alpha} \]

which gives a static margin of

\[ \mathrm{Static Margin} := \frac{x_{CG} - x_{NP}}{\bar{c}} = \frac{\partial C_M / \partial \alpha} {\partial C_L / \partial \alpha} \]

with moments calculated about the center of gravity, as they are in XFLR5.