Code covered by the BSD License  

Highlights from
The Long-term Evolution of Geosynchronous Transfer Orbits

The Long-term Evolution of Geosynchronous Transfer Orbits

by

 

Interactive MATLAB script that predicts the long-term evolution of geosynchronous transfer orbits.

gettime
function [uthr, utmin, utsec] = gettime

% interactive request and input of universal time

% output

%  uthr  = universal time (hours)
%  utmin = universal time (minutes)
%  utsec = universal time (seconds)

% Orbital Mechanics with MATLAB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for itry = 1:1:5
    fprintf('\nplease input the universal time');

    fprintf('\n(0 <= hours <= 24, 0 <= minutes <= 60, 0 <= seconds <= 60)\n');

    utstr = input('? ', 's');

    tl = size(utstr);

    ci = findstr(utstr, ',');

    % extract hours, minutes and seconds

    uthr = str2double(utstr(1:ci(1)-1));

    utmin = str2double(utstr(ci(1)+1:ci(2)-1));

    utsec = str2double(utstr(ci(2)+1:tl(2)));

    % check for valid inputs

    if (uthr >= 0 && uthr <= 24 && utmin >= 0 && utmin <= 60 ...
            && utsec >= 0 && utsec <= 60)
        break;
    end
end

Contact us