Untitled
matlab
a month ago
1.2 kB
3
Indexable
Never
% Loop through each TLE file for i = 1:7758 tleFile = tleFiles{i}; tleFilePath = tleFile; [epochYearArray, month, day] = extractTLEData(tleFilePath); try % Create the satellite object using the TLE file sat = satellite(sc, tleFile); % Calculate the year for the specified date year = 2000 + epochYearArray; % Specify the time for which you want to get position and velocity time = datetime(year, month, day, 12, 0, 0); % Compute position and velocity in ECEF coordinate frame [position, velocity] = states(sat, time, "CoordinateFrame", "ecef"); % Display the results disp("TLE File: " + tleFile); position_realn(i) = (norm(position') / 1000) - 6371; velocity_realn(i) = norm(velocity') / 1000; disp(time); disp("Position (ECEF) [km]: " + position_realn(i)); disp("Velocity (ECEF) [km/s]: " + velocity_realn(i)); disp("-------------------------------"); catch exception fprintf('Inconsistent data in iteration %d, skipped.\n', i); disp("Error Message: " + exception.message); end end