Home » Posts tagged 'J2'

# Tag Archives: J2

## Sun-Synchronous Circular Orbit, Inclination vs Altitude (LEO,J2 perturbed)

This code is a MATLAB script that can be used to design and analyze Sun-synchronous orbits. A Sun-synchronous orbit is a geocentric orbit which combines altitude and inclination in such a way that an object in this orbit has an a nodal regression rate which is equals to Earth’s orbital rotation speed around the Sun. The object in this orbit constantly illuminated by the Sun.

Output: Inclination vs Altitude Plot

```clc;
clear all;
mu    = 398600.440;      % Earth’s gravitational parameter [km^3/s^2]
Re = 6378;               % Earth radius [km]
J2  = 0.0010826269;      % Second zonal gravity harmonic of the Earth
we = 1.99106e-7;    % Mean motion of the Earth in its orbit around the Sun [rad/s]
% Input
Alt = 250:5:1000;     % Altitude,Low Earth orbit (LEO)
a   = Alt + Re;       % Mean semimajor axis [km]
e   = 0.0;            % Eccentricity```
```h = a*(1 - e^2);     % [km]
n = (mu./a.^3).^0.5; % Mean motion [s-1]
tol = 1e-10;         % Error tolerance
% Initial guess for the orbital inclination
i0 = 180/pi*acos(-2/3*(h/Re).^2*we./(n*J2));
err = 1e1;
while(err >= tol )
% J2 perturbed mean motion
np  = n.*(1 + 1.5*J2*(Re./h).^2.*(1 - e^2)^0.5.*(1 - 3/2*sind(i0).^2));
i = 180/pi*acos(-2/3*(h/Re).^2*we./(np*J2));
err = abs(i - i0);
i0 = i;
end```
```plot(Alt,i,'.b');
grid on;hold on;
xlabel('Altitude,Low Earth orbit (LEO)');
ylabel('Mean orbital inclination');
title('Sun-Synchronous Circular Orbit,Inclination vs Altitude(LEO,J2 perturbed)');
hold off;```

## Sun-Synchronous (Heliosynchronous) Orbit, Mean Orbital Inclination (J2 perturbed)

This code is a MATLAB script that can be used to design and analyze Sun-synchronous orbits. A Sun-synchronous orbit is a geocentric orbit which combines altitude and inclination in such a way that an object in this orbit has an a nodal regression rate which is equals to Earth’s orbital rotation speed around the Sun. The object in this orbit constantly illuminated by the Sun. Input: a = Mean semimajor axis, e = Eccentricity

Output: i = Mean orbital inclination

```clc;
clear all;
mu    = 398600.440;      % Earth’s gravitational parameter [km^3/s^2]
Re = 6378;               % Earth radius [km]
J2  = 0.0010826269;      % Second zonal gravity harmonic of the Earth
we = 1.99106e-7;    % Mean motion of the Earth in its orbit around the Sun [rad/s]
% Input
a = 7378;           % Mean semimajor axis [km]
e = 0.05;           % Eccentricity```
```h = a*(1 - e^2);    % [km]
n = (mu/a^3)^0.5;   % Mean motion [s-1]
tol = 1e-10;        % Error tolerance
% Initial guess for the orbital inclination
i0 = 180/pi*acos(-2/3*(h/Re)^2*we/(n*J2));
err = 1e1;
while(err >= tol )
% J2 perturbed mean motion
np  = n*(1 + 1.5*J2*(Re/h)^2*(1 - e^2)^0.5*(1 - 3/2*sind(i0)^2));
i = 180/pi*acos(-2/3*(h/Re)^2*we/(np*J2));
err = abs(i - i0);
i0 = i;
end
fprintf('Mean orbital inclination %4.5f [deg] \n',i);```
`Mean orbital inclination 99.43667 [deg]`

## GPS Satellite Constellation

The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites.

```clc;
clear all;
fname = 'GPS.txt';    % TLE file name
Earth3DPlot(1);
% Open the TLE file and read TLE elements
fid = fopen(fname, 'rb');
while ~feof(fid)
[ h, i, RAAN, e,omega,theta ] = TLE2OE( fid );
[Rv, alfa,delta ] = J2PropagR( h, i, RAAN, e,omega,theta) ;
scatter3(Rv(:,1),Rv(:,2),Rv(:,3),'.');
end
fclose(fid);
% Ground Track
EarthTopographicMap(2,820,420);
fid = fopen(fname, 'rb');
while ~feof(fid)
[ h, i, RAAN, e,omega,theta ] = TLE2OE( fid );
[Rv, alfa,delta ] = J2PropagR( h, i, RAAN, e,omega,theta) ;
scatter(alfa,delta,'.');
end
fclose(fid);
text(280,-80,'smallsats.org','Color',[1 1 1], 'VerticalAlignment','middle',...
'HorizontalAlignment','left','FontSize',14 );
title('GPS Satellite Constellation');```

TLE Data Source. http://www.celestrak.com/ January 20, 2012

```GPS BIIA-10 (PRN 32)
1 20959U 90103A   13018.84945698  .00000048  00000-0  10000-3 0  8427
2 20959  54.4303 229.9128 0117665 335.2539  24.2342  2.00550891162214
GPS BIIA-14 (PRN 26)
1 22014U 92039A   13019.14607454 -.00000071  00000-0  10000-3 0  6346
2 22014  56.1801 290.1218 0208290  69.5584 292.7075  2.00565875143955
GPS BIIA-15 (PRN 27)
1 22108U 92058A   13018.75434799 -.00000089  00000-0  10000-3 0  5581
2 22108  56.2534 343.0502 0222435 303.9410  53.9615  2.00569608149127
GPS BIIA-21 (PRN 09)
1 22700U 93042A   13018.74470584 -.00000088  00000-0  00000+0 0  8817
2 22700  56.4056 344.6226 0167916  93.9179 268.0033  2.00662093143282
GPS BIIA-22 (PRN 30)
1 22779U 93054A   13018.51983509 -.00000069  00000-0  10000-3 0  5571
2 22779  55.1533  39.1818 0106140  92.6721 268.5873  2.00571221142039
GPS BIIA-23 (PRN 04)
1 22877U 93068A   13018.41796082  .00000048  00000-0  10000-3 0  2373
2 22877  53.7295 164.7980 0102485  54.0859 306.8291  2.00556733140921
GPS BIIA-24 (PRN 06)
1 23027U 94016A   13018.12046811 -.00000048  00000-0  10000-3 0  1955
2 23027  53.8565 101.4536 0076290 335.9203  23.7554  2.00561802138223
GPS BIIA-25 (PRN 03)
1 23833U 96019A   13019.13913939 -.00000060  00000-0  10000-3 0  3935
2 23833  53.4736  96.9153 0157826  72.6851 289.0689  2.00564035123227
GPS BIIA-26 (PRN 10)
1 23953U 96041A   13018.50101030  .00000050  00000-0  10000-3 0  8803
2 23953  54.1034 225.9914 0120793  44.6889 316.3194  2.00554012121004
GPS BIIR-2  (PRN 13)
1 24876U 97035A   13019.00325574 -.00000072  00000-0  10000-3 0  3517
2 24876  56.3255 290.5219 0046517 120.2494 240.2582  2.00575732113546
GPS BIIA-28 (PRN 08)
1 25030U 97067A   13019.63536166 -.00000082  00000-0  10000-3 0  2975
2 25030  57.1991 351.0337 0128256 195.9414 163.6595  2.00570836111451
GPS BIIR-3  (PRN 11)
1 25933U 99055A   13019.25617045  .00000010  00000-0  10000-3 0  7874
2 25933  50.9146 148.4260 0136447  65.1740 296.2085  2.00561387 97361
GPS BIIR-4  (PRN 20)
1 26360U 00025A   13016.87981762  .00000037  00000-0  10000-3 0  8761
2 26360  53.2134 222.1388 0052448  73.0764 287.5347  2.00576559 93011
GPS BIIR-5  (PRN 28)
1 26407U 00040A   13019.21994987 -.00000062  00000-0  10000-3 0  8291
2 26407  56.2531  48.0068 0187923 257.4922 100.4450  2.00568287 91732
GPS BIIR-6  (PRN 14)
1 26605U 00071A   13018.81568033 -.00000070  00000-0  10000-3 0  8445
2 26605  55.9113 288.9048 0069360 245.5421 113.7790  2.00561684 89323
GPS BIIR-7  (PRN 18)
1 26690U 01004A   13018.69048158  .00000051  00000-0  10000-3 0  7237
2 26690  53.1752 225.1291 0138193 238.6253 120.0544  2.00553471 87732
GPS BIIR-8  (PRN 16)
1 27663U 03005A   13019.05927186 -.00000062  00000-0  10000-3 0  1540
2 27663  56.3455  47.6478 0068033 359.8082   0.2361  2.00576901 73096
GPS BIIR-9  (PRN 21)
1 27704U 03010A   13018.60667007  .00000047  00000-0  10000-3 0   377
2 27704  53.3697 165.0440 0198594 235.2103 122.8804  2.00553928 71879
GPS BIIR-10 (PRN 22)
1 28129U 03058A   13018.73549856  .00000051  00000-0  10000-3 0  6108
2 28129  53.0451 225.2919 0063340 244.9211 114.4621  2.00564098 66589
GPS BIIR-11 (PRN 19)
1 28190U 04009A   13019.17516771 -.00000046  00000-0  10000-3 0  6040
2 28190  55.1066 110.1249 0086959  14.6182 345.6476  2.00565996 64762
GPS BIIR-12 (PRN 23)
1 28361U 04023A   13018.96324076 -.00000066  00000-0  10000-3 0  4238
2 28361  54.8505 285.6669 0081990 194.9306 164.8791  2.00552385 62846
GPS BIIR-13 (PRN 02)
1 28474U 04045A   13018.96367060  .00000044  00000-0  10000-3 0  3107
2 28474  53.7850 163.8242 0119722 206.9062 152.4399  2.00573321 60202
GPS BIIRM-1 (PRN 17)
1 28874U 05038A   13018.32217387 -.00000042  00000-0  10000-3 0  5695
2 28874  55.2624 107.1585 0081479 231.4916 127.7975  2.00551100 53614
GPS BIIRM-2 (PRN 31)
1 29486U 06042A   13018.93123473 -.00000087  00000-0  10000-3 0  9604
2 29486  56.1978 346.2221 0082935 312.3064  46.9875  2.00549243 46326
GPS BIIRM-3 (PRN 12)
1 29601U 06052A   13019.37101994 -.00000060  00000-0  10000-3 0  9912
2 29601  56.3013  46.5841 0041062   4.7967 355.2950  2.00567097 45242
GPS BIIRM-4 (PRN 15)
1 32260U 07047A   13018.68384066 -.00000063  00000-0  00000+0 0  6980
2 32260  54.0003 283.4336 0051688   4.0264 356.0623  2.00561108 38627
GPS BIIRM-5 (PRN 29)
1 32384U 07062A   13018.50083400 -.00000043  00000-0  10000-3 0  7369
2 32384  55.2952 107.6507 0020298 293.2614  66.5488  2.00557842 37341
GPS BIIRM-6 (PRN 07)
1 32711U 08012A   13019.09384597 -.00000088  00000-0  10000-3 0  4945
2 32711  55.9093 345.9893 0061210 195.1431 164.6734  2.00559437 35567
GPS BIIRM-8 (PRN 05)
1 35752U 09043A   13018.56516204  .00000053  00000-0  10000-3 0  2489
2 35752  54.3995 224.8319 0030098  13.9303 346.1949  2.00578808 25132
GPS BIIF-1  (PRN 25)
1 36585U 10022A   13018.91284136 -.00000065  00000-0  10000-3 0   648
2 36585  55.6614  44.4964 0018446  28.7965 331.3534  2.00571492 19380
GPS BIIF-2  (PRN 01)
1 37753U 11036A   13019.28928872  .00000046  00000-0  00000+0 0  5261
2 37753  55.0147 164.8917 0014277  20.5806 339.4484  2.00559276 11077
GPS BIIF-3  (PRN 24)
1 38833U 12053A   13018.77758384 -.00000091  00000-0  00000+0 0   731
2 38833  54.9671 344.4909 0005362 333.1108  26.8609  2.00559339  2129```

## Iridium Satellite Constellation

The Iridium satellite constellation is a large group of satellites providing voice and data coverage to satellite phones, pagers and integrated transceivers over Earth’s entire surface. For Algorithms used in this post look for J2 Propagator example in previous posts. TLE Data Source. http://www.celestrak.com/ January 20, 2012

```clc;
clear all;
fname = 'Iridium.txt';    % TLE file name
Earth3DPlot(1);
% Open the TLE file and read TLE elements
fid = fopen(fname, 'rb');
while ~feof(fid)
[ h, i, RAAN, e,omega,theta ] = TLE2OE( fid );
[Rv, alfa,delta ] = J2PropagR( h, i, RAAN, e,omega,theta) ;
scatter3(Rv(:,1),Rv(:,2),Rv(:,3),'.');
%scatter(alfa,delta,'.');
end
fclose(fid);
% Ground Track
EarthTopographicMap(2,820,420);
fid = fopen(fname, 'rb');
while ~feof(fid)
[ h, i, RAAN, e,omega,theta ] = TLE2OE( fid );
[Rv, alfa,delta ] = J2PropagR( h, i, RAAN, e,omega,theta) ;
scatter(alfa,delta,'.');
end
fclose(fid);
text(280,-80,'smallsats.org','Color',[1 1 1], 'VerticalAlignment','middle',...
'HorizontalAlignment','left','FontSize',14 );
title('Iridium Satellite Constellation');```

```IRIDIUM 8 [+]
1 24792U 97020A   13019.25828200  .00000326  00000-0  10925-3 0  1963
2 24792  86.3934 271.5793 0002226  81.2735 278.8697 14.34220916822440
IRIDIUM 7 [+]
1 24793U 97020B   13019.25197876 -.00000503  00000-0 -18675-3 0  1983
2 24793  86.3945 271.7767 0002220  84.7209 275.4206 14.34215565822447
IRIDIUM 6 [+]
1 24794U 97020C   13020.15258204 -.00000555  00000-0 -20547-3 0    64
2 24794  86.3943 271.3667 0002055  91.6836 268.4734 14.34211576822570
IRIDIUM 5 [+]
1 24795U 97020D   13019.23925838  .00000329  00000-0  11041-3 0  3920
2 24795  86.3940 271.8568 0002884  94.1872 265.9660 14.34220500822523
IRIDIUM 4 [-]
1 24796U 97020E   13019.18979874  .00000271  00000-0  89606-4 0  2337
2 24796  86.3937 271.4666 0002262  84.3259 275.8183 14.34306383822451
IRIDIUM 914 [-]
1 24836U 97030A   13019.20345150  .00000212  00000-0  63561-4 0  7657
2 24836  86.3963 292.5492 0002155  58.6600 103.8688 14.37894932817517
IRIDIUM 12 [+]
1 24837U 97030B   13019.25535178  .00000381  00000-0  12913-3 0  2111
2 24837  86.3966 303.0298 0002355  78.3314 281.8152 14.34224536816196
IRIDIUM 10 [+]
1 24839U 97030D   13019.24267022  .00000398  00000-0  13513-3 0  2139
2 24839  86.3963 303.0252 0002313  79.6634 280.4838 14.34223673816207
IRIDIUM 13 [+]
1 24840U 97030E   13019.33146516  .00000486  00000-0  16659-3 0  1596
2 24840  86.3971 303.0933 0002297  80.2477 279.8974 14.34224246816208
IRIDIUM 16 [-]
1 24841U 97030F   13019.29063765  .00000373  00000-0  12216-3 0  1877
2 24841  86.4054 303.7554 0003596 109.2676 250.8904 14.35757128816500
IRIDIUM 911 [-]
1 24842U 97030G   13020.20773527  .00000234  00000-0  62641-4 0  8551
2 24842  86.4500 305.0286 0015683  38.2954 111.5834 14.43796646820680
IRIDIUM 15 [+]
1 24869U 97034A   13019.39200756  .00000441  00000-0  15046-3 0  2562
2 24869  86.3964 334.6667 0002522  80.2051 279.9444 14.34216310813184
IRIDIUM 17 [-]
1 24870U 97034B   13019.40804263  .00000374  00000-0  12479-3 0  1762
2 24870  86.3958 334.2377 0002456  71.7924 288.3538 14.34899576813250
IRIDIUM 920 [-]
1 24871U 97034C   13018.95829477  .00000217  00000-0  64458-4 0  8045
2 24871  86.4013 324.4734 0010511 225.2632 163.0156 14.38557564814770
IRIDIUM 18 [+]
1 24872U 97034D   13019.35396626  .00000423  00000-0  14393-3 0  1927
2 24872  86.3969 334.8716 0002418  86.6122 273.5367 14.34215618813176
IRIDIUM 921 [-]
1 24873U 97034E   13020.22218146  .00002090  00000-0  16212-3 0  2998
2 24873  86.3868 101.9576 0010785 117.9015 299.2404 15.00783240845815
IRIDIUM 26 [-]
1 24903U 97043A   13019.29134437  .00000171  00000-0  53633-4 0  3142
2 24903  86.3933 208.3646 0002274  83.3209 276.8239 14.34476984807115
IRIDIUM 25 [+]
1 24904U 97043B   13019.44172922  .00000050  00000-0  10965-4 0  2125
2 24904  86.3924 208.2554 0002148  81.2923 278.8522 14.34218816807095
IRIDIUM 46 [+]
1 24905U 97043C   13019.45441752 -.00000537  00000-0 -19870-3 0  2245
2 24905  86.3943 208.6532 0002113  86.0161 274.1278 14.34214094807109
IRIDIUM 23 [S]
1 24906U 97043D   13019.42961336  .00000077  00000-0  20290-4 0  2301
2 24906  86.3925 208.1768 0002105  83.6697 276.4740 14.34214706807103
IRIDIUM 22 [+]
1 24907U 97043E   13019.07385532 -.00000454  00000-0 -16920-3 0  1899
2 24907  86.3935 208.8899 0002169  79.5028 280.6412 14.34219764807055
DUMMY MASS 1 [-]
1 24925U 97048A   13019.70792417  .00000238  00000-0  25125-4 0  4000
2 24925  86.3327  65.0051 0005583 346.5268 149.0153 14.84265252832774
DUMMY MASS 2 [-]
1 24926U 97048B   13019.70170321  .00000226  00000-0  23822-4 0  3890
2 24926  86.3328  65.8623 0006587 351.2172 148.1866 14.84042008832651
IRIDIUM 29 [+]
1 24944U 97051A   13019.15337614  .00000137  00000-0  41734-4 0  1490
2 24944  86.3920 240.0018 0002175  82.5044 277.6386 14.34219380803630
IRIDIUM 32 [+]
1 24945U 97051B   13019.17240299 -.00001114  00000-0 -40484-3 0  1864
2 24945  86.3918 240.0169 0002170  87.6880 272.4570 14.34213936803655
IRIDIUM 33 [-]
1 24946U 97051C   13020.18831512  .00000175  00000-0  56862-4 0  2786
2 24946  86.3852 239.7658 0010014  87.9435  13.0341 14.32857018803575
IRIDIUM 28 [-]
1 24948U 97051E   13019.18549225  .00000209  00000-0  66975-4 0   392
2 24948  86.3943 240.0163 0002504 109.4543  39.7656 14.34732376803653
IRIDIUM 30 [+]
1 24949U 97051F   13019.16606417  .00000083  00000-0  22655-4 0  2285
2 24949  86.3914 240.0916 0002069  84.5363 275.6059 14.34219125803635
IRIDIUM 31 [+]
1 24950U 97051G   13019.15971742  .00000095  00000-0  26733-4 0  1881
2 24950  86.3912 240.0988 0002754  57.9016 302.2436 14.34223532803648
IRIDIUM 19 [+]
1 24965U 97056A   13019.21386943 -.00002494  00000-0 -89800-3 0  1758
2 24965  86.3939 271.5895 0002324  82.2007 277.9396 14.34210541801796
IRIDIUM 35 [+]
1 24966U 97056B   13019.36611351  .00000384  00000-0  13002-3 0  2272
2 24966  86.3946 271.5378 0002265  79.6507 280.4928 14.34221101801794
IRIDIUM 36 [-]
1 24967U 97056C   13020.21122838  .00000195  00000-0  61766-4 0  1524
2 24967  86.3974 271.1775 0002148  99.2787  47.2898 14.34747586802089
IRIDIUM 37 [+]
1 24968U 97056D   13019.20119965  .00000299  00000-0  99535-4 0  1822
2 24968  86.3939 271.7452 0002237  78.7252 281.4205 14.34220808801779
IRIDIUM 34 [+]
1 24969U 97056E   13019.29000192  .00000393  00000-0  13336-3 0  1697
2 24969  86.3946 271.6484 0002281  83.3693 276.7770 14.34221331801789
IRIDIUM 43 [+]
1 25039U 97069A   13019.34760118  .00000451  00000-0  15383-3 0  1764
2 25039  86.3975 334.8350 0002732  75.4578 284.6933 14.34216124795571
IRIDIUM 41 [+]
1 25040U 97069B   13019.34125956  .00000124  00000-0  37101-4 0  1693
2 25040  86.3975 334.7833 0002400  87.8563 272.2897 14.34219942795574
IRIDIUM 40 [+]
1 25041U 97069C   13019.29686359 -.00000498  00000-0 -18492-3 0  1975
2 25041  86.3971 334.7525 0002527  85.4810 274.6730 14.34212842795583
IRIDIUM 39 [+]
1 25042U 97069D   13019.30321589  .00000452  00000-0  15445-3 0  1781
2 25042  86.3990 335.0132 0002068  97.2505 262.8938 14.34216624795564
IRIDIUM 38 [-]
1 25043U 97069E   13018.93734748  .00000211  00000-0  66912-4 0  1650
2 25043  86.3999 333.7245 0003080 121.7814 299.2150 14.35164863795709
IRIDIUM 42 [+]
1 25077U 97077A   13019.29053708  .00000433  00000-0  14738-3 0  1818
2 25077  86.3969 334.8569 0002536  82.3130 277.8369 14.34215449791427
IRIDIUM 44 [-]
1 25078U 97077B   13020.18276462  .00000167  00000-0  49514-4 0  6521
2 25078  86.4006 327.7485 0003735 121.1671   9.7924 14.37114346792453
IRIDIUM 45 [+]
1 25104U 97082A   13019.23876329 -.00000896  00000-0 -32699-3 0  1362
2 25104  86.3930 208.3285 0002196  82.3576 277.7865 14.34214498789613
IRIDIUM 24 [-]
1 25105U 97082B   13020.21010638  .00000243  00000-0  72689-4 0  7090
2 25105  86.3936 194.3185 0010600 229.8673 255.8995 14.38833044791407
IRIDIUM 47 [+]
1 25106U 97082C   13019.25144752 -.00000094  00000-0 -40610-4 0  1143
2 25106  86.3919 208.2578 0001665  90.0600 270.0783 14.34217923789611
IRIDIUM 49 [+]
1 25108U 97082E   13019.47355223  .00000270  00000-0  89230-4 0  1422
2 25108  86.3928 208.2251 0002076  86.5174 273.6268 14.34222005789652
IRIDIUM 52 [+]
1 25169U 98010A   13019.29340342  .00000496  00000-0  16991-3 0  9024
2 25169  86.3966 303.2330 0002373  77.8507 282.2951 14.34224631781034
IRIDIUM 56 [+]
1 25170U 98010B   13019.28704736 -.00002350  00000-0 -84673-3 0  6938
2 25170  86.3978 303.3126 0002513  78.8408 281.3229 14.34207251781015
IRIDIUM 54 [+]
1 25171U 98010C   13019.24901286  .00000359  00000-0  12110-3 0  1403
2 25171  86.3978 303.2636 0002412  78.2931 281.8543 14.34223411781171
IRIDIUM 50 [+]
1 25172U 98010D   13019.35053981  .00000438  00000-0  14943-3 0  1770
2 25172  86.3973 303.1858 0002393  77.9142 282.2320 14.34231173781026
IRIDIUM 53 [+]
1 25173U 98010E   13019.36952395  .00000522  00000-0  17935-3 0  1553
2 25173  86.3965 303.1853 0002380  80.3006 279.8457 14.34224163781031
IRIDIUM 51 [S]
1 25262U 98018A   13019.25184820  .00000149  00000-0  46028-4 0  2932
2 25262  86.3949 271.8491 0002131  87.7931 272.3473 14.34226063780400
IRIDIUM 61 [+]
1 25263U 98018B   13020.11453228 -.00000705  00000-0 -25904-3 0  1030
2 25263  86.3937 271.3336 0002223  85.9093 274.2468 14.34210888776231
IRIDIUM 55 [+]
1 25272U 98019A   13019.28022689 -.00000320  00000-0 -12146-3 0  1071
2 25272  86.3913 239.8919 0002123  85.6132 274.5266 14.34216614775311
IRIDIUM 57 [+]
1 25273U 98019B   13019.18508789 -.00000818  00000-0 -29914-3 0  1412
2 25273  86.3918 240.1671 0002253  83.8519 276.2933 14.34214753775301
IRIDIUM 58 [+]
1 25274U 98019C   13019.12166106  .00000158  00000-0  49323-4 0  9577
2 25274  86.3922 240.3440 0002085  85.1053 275.0389 14.34223937775298
IRIDIUM 59 [+]
1 25275U 98019D   13019.47684150 -.00000017  00000-0 -13194-4 0  7403
2 25275  86.3971 240.1372 0002140  59.8338 300.3065 14.34221068775343
IRIDIUM 60 [+]
1 25276U 98019E   13019.13435185  .00000122  00000-0  36325-4 0  1836
2 25276  86.3910 239.9614 0002201  84.4079 275.7369 14.34219041775290
IRIDIUM 62 [+]
1 25285U 98021A   13019.37487346  .00000270  00000-0  89388-4 0  1607
2 25285  86.3964 176.7700 0001974  86.2148 273.9282 14.34218061774289
IRIDIUM 63 [+]
1 25286U 98021B   13019.38116229 -.00000555  00000-0 -20531-3 0  1745
2 25286  86.3965 176.9067 0002040  80.1666 279.9793 14.34210551774281
IRIDIUM 64 [+]
1 25287U 98021C   13019.38755872  .00000194  00000-0  62115-4 0  1077
2 25287  86.3966 176.7928 0002635  83.5815 276.5707 14.34217563774266
IRIDIUM 65 [+]
1 25288U 98021D   13019.39390155  .00000224  00000-0  72901-4 0  1481
2 25288  86.3960 176.7232 0002088  87.7553 272.3894 14.34218178774282
IRIDIUM 66 [+]
1 25289U 98021E   13019.40024514  .00000276  00000-0  91434-4 0   924
2 25289  86.3961 176.6380 0002040  86.6304 273.5143 14.34217879774284
IRIDIUM 67 [+]
1 25290U 98021F   13019.40658708  .00000208  00000-0  67066-4 0  9203
2 25290  86.3963 176.7468 0002122  83.6298 276.5154 14.34217387774296
IRIDIUM 68 [+]
1 25291U 98021G   13019.41293488  .00000170  00000-0  53509-4 0  1459
2 25291  86.3961 176.8325 0002003  84.0717 276.0724 14.34217307774264
IRIDIUM 69 [-]
1 25319U 98026A   13020.07089449  .00000234  00000-0  71292-4 0  9457
2 25319  86.3987 202.1317 0003488 127.2588  21.4608 14.37647589771757
IRIDIUM 71 [-]
1 25320U 98026B   13020.08413631  .00000227  00000-0  68229-4 0  6460
2 25320  86.3977 198.8183 0001951 167.4208 343.1557 14.38170592772112
IRIDIUM 70 [+]
1 25342U 98032A   13019.36852929  .00000267  00000-0  88145-4 0  1779
2 25342  86.3971 177.0171 0001906  90.0985 270.0444 14.34218090768366
IRIDIUM 72 [+]
1 25343U 98032B   13019.35584896  .00000236  00000-0  77164-4 0  1588
2 25343  86.3962 176.7399 0002115  84.7147 275.4303 14.34217456768366
IRIDIUM 73 [-]
1 25344U 98032C   13018.99395123  .00000351  00000-0  89616-4 0   325
2 25344  86.4467 162.8525 0002511  92.8910  46.4311 14.47776697774467
IRIDIUM 74 [S]
1 25345U 98032D   13019.39443214  .00000319  00000-0  89489-4 0  2230
2 25345  86.4473 176.9786 0002184  76.2355 283.9111 14.42954688770617
IRIDIUM 75 [+]
1 25346U 98032E   13019.36218660  .00000245  00000-0  80357-4 0  1820
2 25346  86.3963 176.9319 0002114  85.1603 274.9840 14.34218193768937
IRIDIUM 3 [+]
1 25431U 98048A   13019.48613037  .00000058  00000-0  13785-4 0  1049
2 25431  86.3927 208.4422 0001870  86.5887 273.5525 14.34218568754896
IRIDIUM 76 [+]
1 25432U 98048B   13019.43539516  .00000072  00000-0  18554-4 0   442
2 25432  86.3925 208.2691 0001892  73.6047 286.5363 14.34222014754873
IRIDIUM 82 [+]
1 25467U 98051A   13019.33493506  .00000093  00000-0  26174-4 0  2780
2 25467  86.3969 334.9495 0002785  91.1479 268.9988 14.34221851755870
IRIDIUM 81 [+]
1 25468U 98051B   13019.32859284  .00000439  00000-0  14956-3 0   998
2 25468  86.3971 334.6434 0002525  80.8422 279.3069 14.34216495752094
IRIDIUM 80 [+]
1 25469U 98051C   13019.30955266  .00000415  00000-0  14112-3 0  1027
2 25469  86.3970 334.8621 0002510  82.0657 278.0836 14.34215664752097
IRIDIUM 77 [+]
1 25471U 98051E   13019.19299270  .00000244  00000-0  80167-4 0  2703
2 25471  86.3991 334.6473 0001773 113.0566 332.8838 14.34217028757272
IRIDIUM 2 [-]
1 25527U 98066A   13019.19680509  .00003627  00000-0  26863-3 0  6142
2 25527  85.5597 251.7497 0009484 162.5069 345.4067 15.02787347774833
IRIDIUM 86 [+]
1 25528U 98066B   13019.27437687  .00000427  00000-0  14550-3 0  3297
2 25528  86.3960 302.8257 0002107  91.8263 268.3170 14.34224594748613
IRIDIUM 84 [+]
1 25530U 98066D   13019.30609118  .00000515  00000-0  17664-3 0  9815
2 25530  86.3974 302.9487 0002370  75.9862 284.1612 14.34224925746250
IRIDIUM 83 [+]
1 25531U 98066E   13019.26802892  .00000420  00000-0  14287-3 0  1180
2 25531  86.3962 303.0253 0002377  80.7990 279.3477 14.34223754743604
IRIDIUM 20 [+]
1 25577U 98074A   13019.46710345  .00000113  00000-0  33362-4 0   232
2 25577  86.3925 208.2006 0002124  81.4888 278.6554 14.34222908737712
IRIDIUM 11 [+]
1 25578U 98074B   13019.41001739  .00000102  00000-0  29296-4 0  2598
2 25578  86.3930 208.4419 0002261  87.6235 272.5223 14.34222606746671
IRIDIUM 14 [S]
1 25777U 99032A   13019.40982228 -.00000544  00000-0 -13171-3 0  2770
2 25777  86.5147 176.7905 0002385  89.9292 270.2159 14.54943661722722
IRIDIUM 21 [+]
1 25778U 99032B   13019.34950351  .00000174  00000-0  55150-4 0   955
2 25778  86.3965 176.8302 0001874  41.5150 318.6195 14.34217775717370
IRIDIUM 91 [+]
1 27372U 02005A   13019.10898298 -.00000869  00000-0 -31753-3 0  7026
2 27372  86.3931 240.5136 0005044  96.2705 263.9068 14.34214548580852
IRIDIUM 90 [S]
1 27373U 02005B   13019.31019289  .00000596  00000-0  17240-3 0  6888
2 27373  86.4473 302.9185 0003863   1.3957 358.7246 14.42958259579206
IRIDIUM 94 [S]
1 27374U 02005C   13019.42902793  .00000050  00000-0  10651-4 0  8654
2 27374  86.3933 208.5398 0002273 302.6836  57.4141 14.34222560585227
IRIDIUM 95 [+]
1 27375U 02005D   13019.28657011 -.00000247  00000-0 -95157-4 0  6651
2 27375  86.3927 240.2321 0002078  80.8445 279.2983 14.34216182580163
IRIDIUM 96 [S]
1 27376U 02005E   13019.15023926  .00000338  00000-0  95724-4 0  8549
2 27376  87.1864 245.4340 0002449 324.5213  35.5824 14.42843918585269
IRIDIUM 97 [+]
1 27450U 02031A   13019.37245032 -.00001841  00000-0 -66474-3 0  5682
2 27450  86.3939 271.7596 0004818  90.0074 270.1675 14.34210479559491
IRIDIUM 98 [S]
1 27451U 02031B   13019.33556017  .00000559  00000-0  16135-3 0  6567
2 27451  86.4457 335.2830 0005725  86.7150 273.4715 14.42953981560067```

## J2 Propagator

In this example we will implement the J2 Perturbation (first-order) propagator which accounts for secular variations in the orbit elements due to Earth oblateness. We do not consider atmospheric drag or solar or lunar gravitational forces.It uses two-line element (TLE) sets as an input. Additionally as an example we wil use the implemented propagator to plot orbits of RADUGA satellites.

```% TLE Data Source. http://www.celestrak.com/  January 20, 2012
clc;
clear all;
Earth3DPlot(1);

mu    = 398600;          % Earth’s gravitational parameter [km^3/s^2]
R_earth = 6378;          % Earth radius [km]
J2 = 0.0010836;
we = 360*(1 + 1/365.25)/(3600*24);      % Earth's rotation [deg/s]
fname = 'Raduga.txt';    % TLE file name
% Open the TLE file and read TLE elements
fid = fopen(fname, 'rb');
while ~feof(fid)
L1 = fscanf(fid,'%23c%*s',1);
L2 = fscanf(fid,'%d%6d%*c%5d%*3c%*2f%f%f%5d%*c%*d%5d%*c%*d%d%5d',[1,9]);
L3 = fscanf(fid,'%d%6d%f%f%f%f%f%f%f%f',[1,9]);
epoch       = L2(1,4)*24*3600;        % Epoch Date and Julian Date Fraction
Db          = L2(1,5);                % Ballistic Coefficient
i           = L3(1,3);                % Inclination [deg]
RAAN        = L3(1,4);        % Right Ascension of the Ascending Node [deg]
e           = L3(1,5)/1e7;            % Eccentricity
omega       = L3(1,6);                % Argument of periapsis [deg]
M           = L3(1,7);                % Mean anomaly [deg]
n           = L3(1,8);                % Mean motion [Revs/day]
% Orbital parametres
a = (mu/(n*2*pi/(24*3600))^2)^(1/3);         % Semi-major axis [km]
T = 2*pi*sqrt(a^3/mu)/60;                    % Period in [min]
rp = a*(1-e);
h = (mu*rp*(1 + e))^0.5;                     % Angular momentum
E = keplerEq(M,e,eps);
theta =  acos((cos(E) -e)/(1 - e*cos(E)))*180/pi;    % [deg] True anomaly

% J2 Propagator
dRAAN = -(1.5*mu^0.5*J2*R_earth^2/((1-e^2)*a^3.5))*cosd(i)*180/pi;
domega = dRAAN*(2.5*sind(i)^2 - 2)/cosd(i);
eps = 1E-9;
dt  = 5;        % time step [sec]
ti  = 0;
j = 1;
while(ti <= T);
E = 2*atan(tand(theta/2)*((1-e)/(1+e))^0.5);
M = E  - e*sin(E);
t0 = M/(2*pi)*T;
t = t0 + dt;
M = 2*pi*t/T;
E = keplerEq(M,e,eps);
theta = 2*atan(tan(E/2)*((1+e)/(1-e))^0.5)*180/pi;
RAAN  = RAAN  +  dRAAN*dt ;
omega = omega + domega*dt;
[R V] = Orbital2State( h, i, RAAN, e,omega,theta);
% Considering Earth's rotation
fi_earth = we*ti;
Rot = [cosd(fi_earth), sind(fi_earth),0;...
-sind(fi_earth),cosd(fi_earth),0;0,0,1];
R = Rot*R;
ti = ti+dt;
Rv(j,:) = R';
j = j+1;
end
scatter3(Rv(:,1),Rv(:,2),Rv(:,3),'.');
end
fclose(fid);
hold off;

% Ground Track
% Open the TLE file and read TLE elements
EarthTopographicMap( 2,820,420);
fid = fopen(fname, 'rb');
while ~feof(fid)
[ h, i, RAAN, e,omega,theta ] = TLE2OE( fid );
[Rv, alfa,delta ] = J2PropagR( h, i, RAAN, e,omega,theta) ;
scatter(alfa,delta,'.');
end
fclose(fid);
figure(2);
text(270,-80,'smallsats.org','Color',[1 1 1], 'VerticalAlignment','middle',...
'HorizontalAlignment','left','FontSize',14 );

Input TLE File: Source  www.celestrak.com

```Raduga.txt
1 23448U 94087A   13017.58278277  .00000000  00000-0  10000-3 0  5863
2 23448  12.7840  37.1920 0005679 124.1377 235.9487  1.00272544 83823