Code covered by the BSD License  

Highlights from
Optimal Impulsive Orbital Transfer

Optimal Impulsive Orbital Transfer

by

 

27 Nov 2012 (Updated )

MATLAB script for the solution of the one and two impulse orbit transfer between two Earth orbits.

[fid, mu, req, oev1, oev2, phi01, phi02, ...
function [fid, mu, req, oev1, oev2, phi01, phi02, ...
    dphi1, dphi2, nphi1, nphi2] = read_oota(filename)

% read orbital elements and simulation
% control data file

% required by oota_matlab.m

% input

%  filename = name of oota data file

% output

%  fid   = file id
%  mu    = Earth gravitational constant (km^3/sec^2)
%  req   = Earth equatorial radius (kilometers)
%  phi01 = initial orbit true anomaly at which to begin search (degrees)
%  phi02 = final orbit true anomaly at which to begin search (degrees)
%  dphi1 = initial orbit true anomaly search increment (degrees)
%  dphi2 = final orbit true anomaly search increment (degrees)
%  nphi1 = number of initial orbit true anomaly search intervals
%  nphi2 = number of final orbit true anomaly search intervals
%  oev1  = initial orbit orbital elements array
%  oev2  = final orbit orbital elements array

% Orbital Mechanics with MATLAB

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

% open data file

fid = fopen(filename, 'r');

% check for file open error

if (fid == -1)
    
    clc; home;
    
    fprintf('\n\n  error: cannot find this file!!');
    
    keycheck;
    
    return;
    
end

% read 81 lines of data

for i = 1:1:81
    
    cline = fgetl(fid);
    
    switch i
        
        case 8
            
            mu = str2double(cline);
        
        case 11
            
            req = str2double(cline);
            
        case 19
            
            oev1(1) = str2double(cline);
            
        case 23
            
            oev1(2) = str2double(cline);
            
        case 27
            
            oev1(3) = str2double(cline);
            
        case 31
            
            oev1(4) = str2double(cline);
            
        case 35
            
            oev1(5) = str2double(cline);
            
        case 43
            
            oev2(1) = str2double(cline);
            
        case 47
            
            oev2(2) = str2double(cline);
            
        case 51
            
            oev2(3) = str2double(cline);
            
        case 55
            
            oev2(4) = str2double(cline);
            
        case 59
            
            oev2(5) = str2double(cline);
            
        case 66
            
            phi01 = str2double(cline);
            
        case 69
            
            phi02 = str2double(cline);
            
        case 72
            
            dphi1 = str2double(cline);
            
        case 75
            
            dphi2 = str2double(cline);
            
        case 78
            
            nphi1 = str2double(cline);
            
        case 81
            
            nphi2 = str2double(cline);
            
    end
end

fclose(fid);

Contact us