Hello,
I’m trying to write a method that will convert state vectors into a TLE.
When converting with stateToTLE it leads to some variability, I assume since this is an osculating TLE.
The question you adress is complicated and there is no perfect answer.
If you want a the exact TLE corresponding to a single state vector, you can use the stateToTLE method. The estimated TLE will be expressed in mean SGP4 orbital elements. Those elements are mean ones, not osculating.
The observed oscillations can be expected because you have N TLEs corresponding to N states.
At the end of your plot, the state vextors look to be closed in time. To my mind, the best method is to have the TLE that best fit these state vestors. For that, you shall not use the stateToTLE method but the FiniteDifferencePropagatorConverter as indicated in the pointed forum thread.