summaryrefslogtreecommitdiff
path: root/Satellite_Communication/chapter_2.ipynb
blob: 62e9c6ded4a5ceb90b5c366fac0ea2d1d26e9a96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter 2: Satellite Orbits and Trajectories"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.1, page no-36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Declaration\n",
      "r1=6370.0        # Earth's Orbit in km\n",
      "r2=630.0         # Height of satellite from surface in km\n",
      "G=6.67*10**-11   # Gravitational constant inNm^2/kg^2\n",
      "M=5.98*10**24    # Mass of earth in kg\n",
      "\n",
      "#Calculation\n",
      "R=r1+r2\n",
      "v=math.sqrt(G*M/(R*10**3))\n",
      "\n",
      "#Result\n",
      "print(\"The velocity of sattelite %.2fkm/s\"%(math.floor(v/10)*10**-2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of sattelite 7.54km/s\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.2, page no-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Declaration\n",
      "A=45000.0    #Apogee in km\n",
      "P=7000.0     #Perigee in km\n",
      "\n",
      "\n",
      "#Calculation\n",
      "#(a)\n",
      "a=(A+P)/2\n",
      "#(b)\n",
      "e=(A-P)/(2*a)\n",
      "#(c)\n",
      "e=(math.floor(e*100))/100\n",
      "d=a*e\n",
      "\n",
      "#Result\n",
      "print(\"(a)\\nSemi-major axis of elliptical orbit is %d km\"%a)\n",
      "print(\"\\n(b)\\nEccentricity = %.2f\"%e)\n",
      "print(\"\\n(c)\\nThe distance between centre of earth and centre of ellipse is %d km \"%d)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Semi-major axis of elliptical orbit is 26000 km\n",
        "\n",
        "(b)\n",
        "Eccentricity = 0.73\n",
        "\n",
        "(c)\n",
        "The distance between centre of earth and centre of ellipse is 18980 km \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.3, page no-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "ma=42000.0        # Major axis distance in Km\n",
      "P=8000.0          # Perigee distance in Km\n",
      "\n",
      "\n",
      "#Calculation\n",
      "A=ma-P\n",
      "e=(A-P)/ma\n",
      "\n",
      "#Result\n",
      "print(\"Apogee=%dkm\\n Eccentricity=%.2f\"%(A,e))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Apogee=34000km\n",
        " Eccentricity=0.62\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.4, page no-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable Declaration\n",
      "e=0.6                #Eccentricity\n",
      "d=18000.0            #distance between earth's centre and centre of ellipse\n",
      "\n",
      "\n",
      "#Calculation\n",
      "a=d/e\n",
      "A=a*(1+e)\n",
      "P=a*(1-e)\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Semi-major axis of elliptical orbit is %d km\\n Apogee distance=%dkm\\n Perigee distance=%dkm\"%(a,A,P))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Semi-major axis of elliptical orbit is 30000 km\n",
        " Apogee distance=48000km\n",
        " Perigee distance=12000km\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.5, page no-38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "AP_diff=30000.0   #difference between apogee and perigee in km\n",
      "AP_sum=62800.0    #Apogee+perigee\n",
      "\n",
      "\n",
      "#Calculation\n",
      "E=AP_diff/AP_sum\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Orbit Eccentricity= %.3f\"%E)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Orbit Eccentricity= 0.478\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.6, page no-38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "R=7000.0*10**3       # sattelite orbit in m\n",
      "mu=39.8*10**13       # constant G*M in Nm^2/kg\n",
      "A=47000.0*10**3      # appogee distance in m\n",
      "P=7000.0*10**3       # perigee distance in m\n",
      "\n",
      "\n",
      "#Calculation\n",
      "v=math.sqrt(mu/R)\n",
      "a=(A+P)/2\n",
      "v1=math.sqrt(mu*((2/R)-(1/a)))\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Velocity of satellite A at point X is v=%.2fkm/s\\nVelocity of satellite B at point X is V=%.3fkm/s\"%(v/1000,v1/1000))\n",
      "#value in book is different at 3rd decimal place."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of satellite A at point X is v=7.54km/s\n",
        "Velocity of satellite B at point X is V=9.949km/s\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.7, page no-39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Declaration\n",
      "R=42000.0*10**3       #sattelite orbit in m\n",
      "mu=39.8*10**13        #constant G*M in Nm^2/kg\n",
      "A=42000.0*10**3       #appogee distance in m\n",
      "P=7000.0*10**3        #perigee distance in m\n",
      "\n",
      "#Calculation\n",
      "v=math.sqrt(mu/R)\n",
      "a=(A+P)/2\n",
      "v1=math.sqrt(mu*((2/R)-(1/a)))\n",
      "\n",
      "#Result\n",
      "print(\"Velocity of satellite A at point X is v=%.3fkm/s\\n Velocity of satellite B at point X is V=%.3fkm/s\"%(v/1000,v1/1000))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of satellite A at point X is v=3.078km/s\n",
        " Velocity of satellite B at point X is V=1.645km/s\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.8, page no-40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "R=25000.0*10**3       #sattelite orbit in m\n",
      "mu=39.8*10**13        #constant G*M in Nm^2/kg\n",
      "A=43000.0*10**3       #appogee distance in m\n",
      "P=7000.0*10**3        #perigee distance in m\n",
      "\n",
      "#Calculation\n",
      "v=math.sqrt(mu/R)\n",
      "a=(A+P)/2\n",
      "v1=math.sqrt(mu*((2/R)-(1/a)))\n",
      "\n",
      "#Result\n",
      "print(\"Velocity of satellite A at point X is v=%.3fkm/s\\n Velocity of satellite B at point X is V=%.3fkm/s\"%(v/1000,v1/1000))\n",
      "#value in book is different at 3rd decimal place."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of satellite A at point X is v=3.990km/s\n",
        " Velocity of satellite B at point X is V=3.990km/s\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.9, page no-40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "a=(50000.0/2)*10**3           #Semi-major axis in m\n",
      "mu=39.8*10**13                #constant G*M in Nm^2/kg\n",
      "\n",
      "\n",
      "#Calculation\n",
      "T=2*math.pi*math.sqrt((a**3)/mu) #math.pi gives variation in answer\n",
      "h=T/(60*60)\n",
      "x=T%3600\n",
      "m=x/60\n",
      "s=x%60\n",
      "\n",
      "#Result\n",
      "print(\"Orbital time period is given by, T = %dsec\\n\\t\\t\\t\\t    = %dh %dm %ds\"%(T,math.floor(h),math.floor(m),math.floor(s)))\n",
      "#value in book is different for seconds."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Orbital time period is given by, T = 39368sec\n",
        "\t\t\t\t    = 10h 56m 8s\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.10, page no-42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "a1=18000.0*10**3           #Semi-major axis for first satellite in m\n",
      "a2=24000.0*10**3           #Semi-major axis f0r 2nd satellite in m\n",
      "\n",
      "#Calculation\n",
      "T2_by_T1=(a2/a1)**(3.0/2.0)\n",
      "\n",
      "#Result\n",
      "print(\"Orbital time period of sattelite 2 is %.2f times that of sattelite 1\"%T2_by_T1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Orbital time period of sattelite 2 is 1.54 times that of sattelite 1\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.11, page no-42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "a=25000.0*10**3       #appogee distance in m\n",
      "b=18330.0*10**3       #perigee distance in m\n",
      "\n",
      "\n",
      "#Calculation\n",
      "e=(math.sqrt(a**2-b**2)/a)\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Apogee distance  = a(1+e)= %dkm\\n Perigee distance = a(1-e)= %dkm\\n\"%(a*(1+e)/1000,math.ceil(a*(1-e)/1000)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Apogee distance  = a(1+e)= 42000km\n",
        " Perigee distance = a(1-e)= 8000km\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.12, page no-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "e=0.6                  # eccentricity of elliptical orbit\n",
      "a=0.97                 # area of shaded region\n",
      "b=2.17                 # Area of non-shaded region\n",
      "t=3                    # time taken by satellite to move from pt B to A\n",
      "\n",
      "\n",
      "#Calculation\n",
      "x=b/a\n",
      "y=x*t\n",
      "\n",
      "#Result\n",
      "print(\"Time taken by satellite to move from A to B is %.3f hours \"%y)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken by satellite to move from A to B is 6.711 hours \n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.13, page no-44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "A=42000.0            # Apogee in km\n",
      "P=8000.0             # Perigee in km\n",
      "v_p=9.142            # velocity at perigee point\n",
      "\n",
      "\n",
      "#Calculation\n",
      "v_a=v_p*P/A\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Velocity at apogee = %.3f km/s\"%v_a)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity at apogee = 1.741 km/s\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.14, page no-44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Declaration\n",
      "theta=56.245      #angle made by direction of satellite with local horizontal\n",
      "d=16000.0         #distance of particular point\n",
      "P=8000.0          #Perigee in m\n",
      "v_p=9.142         #velocity at perigee point\n",
      "\n",
      "\n",
      "#Calculation\n",
      "v=(P*v_p)/(d*math.floor(math.cos(theta*math.pi/180)*1000)/1000)\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"The velocity of satellite at that particular point is %.3f km/s\"%v)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of satellite at that particular point is 8.236 km/s\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.16, page no-49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "A1=12000.0                 # first Apogee distance\n",
      "P=8000.0                   # Perigee distance\n",
      "v1=1.0                     # assume v1 as 1\n",
      "v2=1.2*v1                  # 20% higher than v1 \n",
      "\n",
      "\n",
      "#Calculation\n",
      "x=(v2/v1)**2\n",
      "k=(((1+(P/A1))/x)-1)\n",
      "k=math.floor(k*10**4)/10**4\n",
      "A2=P/k\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"A2 = %.0fkm\"%math.ceil(A2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "A2 = 50826km\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.17, page no-50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "vp=8.0         # horizontal velocity of satellite in km/s\n",
      "r=1620.0       # distance from earth's surface in km\n",
      "R=6380.0       # Earth's radius in km\n",
      "d=10000.0      # distance of point at which velocity to be calculated\n",
      "theta=30.0     # angle made by satellite with local horzon at that point\n",
      "\n",
      "\n",
      "#Calculation\n",
      "P=r+R\n",
      "v=(vp*P)/(d*math.cos(theta*math.pi/180))\n",
      "\n",
      "#Result\n",
      "print(\"v = %.2f km/s\"%v)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "v = 7.39 km/s\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.18, page no-50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Declaration\n",
      "r=620.0         # distance from earth's surface in km\n",
      "vp=8.0          # horizontal velocity of satelliteat 9000km height in km/s\n",
      "R=6380.0        # Earth's radius in km\n",
      "d=9000.0        # distance of point at which velocity to be calculated\n",
      "theta=30.0      # angle made by satellite with local horzon at that point\n",
      "mu=39.8*10**13  # Nm**2/kg\n",
      "\n",
      "\n",
      "#Calculation\n",
      "P=r+R\n",
      "m=vp*d*math.cos(theta*math.pi/180)/P    #m=sqrt((2mu/P)-[2mu/(A+P)])\n",
      "m=(m*10**3)**2\n",
      "x=(2*mu/(P*10**3))-m          #x=[2mu/(A+P)]\n",
      "x=math.floor(x/10**4)*10**4\n",
      "k=(2*mu)/x               #k=A+P\n",
      "k=math.ceil(k/10**4)*10**4\n",
      "A=k-(P*10**3)\n",
      "\n",
      "#Result\n",
      "print(\"A = %.0f km\"%(A/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "A = 16170 km\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.19, page no-58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "#variable declaration\n",
      "R=6380                  #Earth's radius in km\n",
      "T=86160                 #Orbital period of Geostationary satellite in km\n",
      "mu=39.8*10**13          #in Nm^2/k\n",
      "\n",
      "#calculations\n",
      "\n",
      "r=(T*math.sqrt(mu)/(2*math.pi))**(2.0/3.0) # Answer matches to the answer given in the book if value of pi is taken as 3.14 \n",
      "\n",
      "#Result\n",
      "print('Radius of satellite is, r = %.0f km'%(r/1000))\n",
      "print('Therefore, height of satellite orbit above earth surface is %.0f km '%((r/1000)-R))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Radius of satellite is, r = 42142 km\n",
        "Therefore, height of satellite orbit above earth surface is 35762 km \n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.20, page no-59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#variable declaration\n",
      "\n",
      "R=6380                  #radius of earth in km\n",
      "P=400                   #Perigee distance in km\n",
      "A=40000                 #Apogee distance in km\n",
      "mu=39.8*10**13          #in Nm^2/k\n",
      "\n",
      "#calculation\n",
      "\n",
      "a=(A+P+R+R)/2           #semi-major axis of the elliptical orbit\n",
      "\n",
      "T=(2*math.pi*(a*10**3)**(3.0/2.0))/math.sqrt(mu)\n",
      "\n",
      "h=T/(60*60)\n",
      "x=T%3600\n",
      "m=x/60\n",
      "s=x%60\n",
      "\n",
      "#Result\n",
      "print('T = %dsec\\n  = %dh %dm %ds\\n\\nThis approximately equal to 12 hour'%(T,math.floor(h),math.floor(m),math.floor(s)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T = 43158sec\n",
        "  = 11h 59m 18s\n",
        "\n",
        "This approximately equal to 12 hour\n"
       ]
      }
     ],
     "prompt_number": 34
    }
   ],
   "metadata": {}
  }
 ]
}