Code covered by the BSD License  

Highlights from
The Gravity Perturbed Hohmann Transfer

The Gravity Perturbed Hohmann Transfer

by

 

28 Feb 2013 (Updated )

MATLAB script for solving the Hohmann transfer problem perturbed by non-spherical Earth gravity.

readgm(fname)
function [ccoef, scoef] = readgm(fname)

% read gravity model data file

% input

%  fname = name of gravity data file

% output

%  ccoef, scoef = gravity model coefficients

% data file format (space delimited ascii)

% column 1 is the degree, column 2 is the order, column 3 are the C coefficients
% and the last column contains the S gravity model coefficients. For example,

% 2     0    -1.08262668355E-003    0.00000000000E+000
% 3     0     2.53265648533E-006    0.00000000000E+000
% 4     0     1.61962159137E-006    0.00000000000E+000

% Orbital Mechanics with MATLAB

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

% read the data file

gdata = dlmread(fname);

nrows = size(gdata, 1);

% initialize coefficients

idim = gdata(nrows, 1) + 1;

ccoef = zeros(idim, idim);

scoef = zeros(idim, idim);

% create gravity model coefficients

for n = 1:nrows
    
    i = gdata(n, 1);
    
    j = gdata(n, 2);
    
    ccoef(i + 1, j + 1) = gdata(n, 3);
    
    scoef(i + 1, j + 1) = gdata(n, 4);
    
end




Contact us