To study the motion of an artificial satellite by solving Newton’s equation for its orbit using Euler method.

Study the motion of artificial satellite by solving Newton’s equation for its orbit using Euler method.







Python Code for Euler's Method(Motion of Satellite)


# -------------------------------------------------------------------------
# Exp -9: To study the motion of an artificial satellite by solving
# N e w t o n s equation for its orbit using Euler method .
# -------------------------------------------------------------------------
import numpy as np
import math
import matplotlib . pyplot as plt

pi = 22.0/7.0;
G = 4* pi **2
M = 1.0
R0 = 1
v = np . sqrt (G* M/ R0 );
n = 4
# -------------------------------------------------------------------------
def euler_orbit (x ,n , t_final ,h):
  T = [ None ]* t_final
  xc = [ None ]* t_final
  yc = [ None ]* t_final
  f = [ None ]* n

  for i in range (0 , t_final ,1) :
    f [0] = x [2];
    f [1] = x [3];
    r = np . sqrt (x [0]**2 + x [1]**2) ;
    f [2] = -( G*M*x [0]) / r **3;
    f [3] = -( G*M*x [1]) / r **3;

    for j in range (0 ,n ,1) :
      x[j ] = x[ j] + h* f[j]

    T[i ] = i* h;
    xc [i] = x [2];
    yc [i] = x [3];
# ------ plot the trajectory of satellite ----- ---- ----- ----- ---- ----- ----- --
  xo = 0.0; yo = 0.0;

  fig , ax = plt . subplots ()
  plt . title (" Satellite motion around the earth ( Euler Method )", fontsize =14)
  ax . plot (xc , yc ,"-r", xo , yo , "ko"); plt . grid ()
  ax . text (1 , 0'Earth', fontsize =14)
  ax . text (1 , -18 , 'Orbit of satellite', fontsize =14 , color ="red")
  plt . xlim ( -12 , 12) ;
  plt . ylim ( -20 , 5) ;
  plt . xlabel ("x- coordinate ", fontsize =14) ;
  plt . ylabel ("y- coordinate ", fontsize =14) ;
  plt . show ()
# -------------------------------------------------------------------------
h = 0.000010
x = [1.0 , 0.0 , 0.0 , 4.0];
t_final = 100000

euler_orbit (x , n , t_final , h )
# -------------------------------------------------------------------------






Comments

Popular posts from this blog

Solving Kepler’s equation by Newton-Raphson method

Velapanti Python Program

Determining Wien’s constant using bisection method and false position method. (Python Program)