Closed jdebecdelievre closed 1 year ago
Since CM_a = CMs_a + CMs_pb * pb_a + CMs_qb * qb_a + CMs_rb * rb_a
now mixes derivatives around x, y, and z, the full fix requires to multiply every CM_...
by [ref.b, ref.c, ref.b]
, do all the calculations, and then re-divide by [ref.b, ref.c, ref.b]
at the end.
Thanks for the catch! I probably just forgot to keep the rotation rates in the stability frame constant when verifying the derivatives. It sounds like you have a good handle on the issue. If you're willing to put together a pull request for this I would greatly appreciate it.
Hi all,
I think that there is a small chain rule term forgotten in the stability derivatives computation with respect to alpha. It in
stability_derivatives.jl
, in thestability_derivatives(system)
function.Line 113,
CF_a = CFs_a
should beCF_a = CFs_a + CFs_pb * pb_a + CFs_qb * qb_a + CFs_rb * rb_a
. Similarly, line 119, we should haveCM_a = CMs_a + CMs_pb * pb_a + CMs_qb * qb_a + CMs_rb * rb_a
.The reason would be that, when taking a partial derivative wrt alpha in the stability frame, we assume that the rotation rates in the stability frame do not change.
Below is a code snippet using the first example from the documentation to compare the analytic solution with finite differences. Note that I use fixed angular velocity in the stability frame when finite differencing.
I'm happy to do a pull request if you would like to incorporate the change. Let me know if I'm missing something!
-Jean
Returns:
The discrepancy is large partly because I've used very large rotation rates. It is fixed with the change that have suggested above.