So....#Lagrange #polynomials. They are pretty dang clever and pretty dang amazing. You can get an analytic (if that's the word I want) polynomial fit! That you can take a continuous derivative!
For arbitrary data, I can see why it might not work.
But for a physical object that actually is moving according to a 2nd-order kinematics (piecewise--really 3rd-order overall) but all you have data for the the first two orders, it might be a good way to recover the higher order(s).
I am still in this rabbit hole, learning a bunch of new #numerical methods.
What I want at the end is *thrust* acceleration values recovered from satellite position and velocity data given at 1m intervals.
Any method will obviously also have the acc due to gravity and other effects. Methods will differ in how much numerical "noise" they add to the process.
Subtracting the Earth is easy with F=ma=GMm/r^2.
To compare the noise, I'm using a smooth #keplerian element set that has no thrusts.
The smooth elset is for a high-e orbit For Reasons which also means the hard part is perigee.
My first naive method was to subtract adjacent velocities. That's awful.
Learning some #numerical methods, I then tried (v(t+1) - v(t-1))/2t. That gives me a 25 mm/s^2 residual acc. Meh.
Lagrange #interpolation gives me 5 mm/s^2. Getting somewhere.
Going back to central diffs but using t-2, t-1, t+1, t+2 I do even better at 1.5 mm/s^2 residual.
But is it good enough? Looking up some real world data on the effect I'm looking for, it looks like my noise is still *way* too big. My effect is .1mm/s^2 or smaller. Ugh. My noise is still 10x that.
So far all of these methods have used just velocity to recover acceleration. Now I'm #learning Hermite and cubic spline #interpolation to use both pos and vel and maybe reduce my error even more.
But I'm only subtracting Earth's #gravity. #sgp4 #orbit propagation also has other perturbations that might contribute to my noise.
If upping the order of my interpolation keeps the "noise" at the same level, I need to consider that what I'm looking at is the Moon's gravity or solar wind or whatever.
It's possible it'll be impossible to untangle my effect from all the other perturbations represented in the data. But at least I'm still #learning useful skills! #math #softwareengineering
Thinking outside the box about how to reduce all effects, I do have another idea in my back pocket.
I could take the state vector at time t and *put it through the #sgp4 propagator* to see what it thinks t+1 should be. Then compare that to what I was given for t+1. Then the diff should be exactly the thrust acceleration.
I'm not sure I have a way to #sgp4 propagate a state vector so I'm leaving that alone for a bit. That'll be the next iteration if real #math doesn't work.
Actually...those effects must not be an issue or I'd already be seeing them at apogee in a high-e #orbit.
My interpolation is only non-flat at perigee, which is exactly where pos, vel and acc are changing fastest and #numerical methods are going to be noisiest.
So I think I just need to reduce noise well below .1mm/s^2 and I should be good...?
Out of curiosity, tried a piecewise-cubic fit. No constraint that the endspoints match beyond position.
Absolute garbage. Bumping up the piecewise fit length and polynomial order a little bit helped some, but still by far the worst option.
There don't seem to be a lot of great, short online sources for hermite interpolation. I really like @acegikmo 's video. It specifically calls out physical situations where acc is not continuous, which I think applies to me.
The intuitive overview in that video seems to be saying you only fit two points at a time which seems odd. But you fit them in position and velocity so maybe not.
Or maybe extend the idea to more points, although then you get into higher orders that probably don't physically exist in this problem.
I guess we'll find out.
I re-implemented the 5pt central difference on my real data and it worked great. Circling back to my at-home tests that showed CD5 wasn''t sufficiently precise, I eventually realized that for speed I had 10x the step size.
The errors in smooth data max ~.1mm/s^2 which is just under the size of the effect I'm looking for.
I won't get *great* data extraction with this, but I'll get enough to know the data is in there and roughly what it looks like to motivate future work. #space #math
The extraction seems to be working really well, but can't tell how well yet
Has two repeating sections. One is very clearly good data that looks as expected
The other looks like noise, but is very repeatable and (partially) points in a way that true noise wouldn't point. Also partially larger than the real effect could be
What I really need is more example data. Fortunately bosses/partners are listening enough to make that happen (maybe)
Today I made the script's random #matplotlib graphs and half-assed #data structures into a coherent system that could be the basis for a future analysis tool for this kind of data. Could be the start of something really cool.
Or really, it *has to be* because this situation is only going to get more common and it needs to be solved ASAP.
A series of chance remarks led to a realization that someone in another group at work might be a lead
That guy casually drops he has a degree in the topic and worked in a lab devoted to it at the university associated with my workplace. How have I not heard of this lab??
Oh and his thesis advisor is now the director. Sure, he can introduce us.
Oh and here's a seminal paper on this topic from 20 years ago that "might help".
https://apps.dtic.mil/sti/pdfs/ADA384536.pdf
Sometimes it pays to send a quick email...