I have already worked on this project for a week, and I still can not solve this problem by myself. How can I update data for the SGP4 OrbitPropagator in Matlab's satellite
function?
The thing I want to do its read the ISS(International Space Station) TLE file, and simulate its orbit with SGP4 Propagator. Until here, I did well, but we know the orbit will lose altitude to drag with time, so I want to give it a delta-V of 1 m/s to maintain its orbit.
I have tried three different ways from MathWorks help, but none of them were successful.
Method 1 :
ISSSGP4 = satellite(sc1, tleFile, "Name", "ISSSGP4", "OrbitPropagator", "sgp4");
The tleFile is the source data which the OrbitPropagator needs, and then I tried to update the TLE file after I give it a delta-V.
[positionSGP4, velocitySGP4] = states(satSGP4, "CoordinateFrame", "ecef");
we can use states
to get current ISS velocity, add the delta-V to it, and do a coordinate transformation, using ijk2keplerian
to get the Keplerian elements which we need to use in the TLE.
[a, ecc, incl, RAAN, argp, nu, truelon, arglat, lonper] = ijk2keplerian(r_ijk, v_ijk);
Mean anomaly and mean motion I can calculate by myself. The problem is, TLE requires very very rigorous format so I can't generate the valid TLE file by just using fprintf.
fid = fopen(tle_filename, 'w');
fprintf(fid, '%s\n', satellite_name);
fprintf(fid, '1 25544U 98067A 23232.99987622 .00013743 00000-0 25255-3 0 9994\n');
fprintf(fid, '2 25544 %.4f %.4f %s %.4f %.4f %f 1847', incl,RAAN,ecc,argp,M_e,n);
fclose(fid);
And, I know trying to generate a TLE file may be a stupid idea.
Method 2:
In the satellite
documentation, we can see they provide another way to do the OrbitPropagator:
satellite(scenario, semimajoraxis, eccentricity, inclination, RAAN, argofperiapsis, trueanomaly)
which means you can add a Satellite object from Keplerian elements defined in the Geocentric Celestial Reference Frame (GCRF) to the satellite scenario.
They also said
If you specify the satellite using Keplerian elements, the OrbitPropagator value can take one of these options:
"two-body-keplerian"
"sgp4"
"sdp4"
means this way should still support the sgp4 OrbitPropagator which I am using. However, when I tried to doing by myself
ISSSGP42 = satellite(sc2, semiMajorAxis, eccentricity, inclination, rightAscensionOfAscendingNode, ...
argumentOfPeriapsis, trueAnomaly, "Name", "ISSSGP4", "OrbitPropagator", "sgp4");
[positionSGP42, velocitySGP42] = states(ISSSGP42, "CoordinateFrame", "ecef");
[positionSGP4_n2, velocitySGP4_n2] = convert_positions(positionSGP42, velocitySGP42);
The operation completed but the response looks wrong to me
The original looked like this
Why is the answer so different?
Method 3: In the satellite documentation, they provide a third way to use the OrbitPropagator.
satellite(scenario, positiontable, velocitytable)
but it cannot use the SGP4, so how does it work?
I know this is asking a lot. Thank you for any help!