Home » Posts tagged 'Numerical Solution'

# Tag Archives: Numerical Solution

## Two Body Problem Numerical Solution,Satellite – Earth, R & V after dT

The initial position and velocity of an earth orbiting satellite in earth centered inertial frame is known. In this example we will numerically solve fundamental equation of relative two-body motion to find the distance of the satellite from the center of the earth and its speed after 24 hours.

clc; clear all; R0 = [6750 0 0]; %[km] V0 = [0 10.5 0]; %[km/s] mu = 398600; % Earth’s gravitational parameter [km^3/s^2] t = 0; % initial time dt = 10; % time step [s] dT = 24*3600; % Time interval [s] % Using fourth-order Runge–Kutta method to solve fundamental equation % of relative two-body motion F_r = @(R) -mu/(norm(R)^3)*R; Rd = V0; R = R0; i = 1; while (t <= dT) Rv(i,:) = R; tv(i) =t; k_1 = dt*F_r(R); k_2 = dt*F_r(R+0.5*k_1); k_3 = dt*F_r(R+0.5*k_2); k_4 = dt*F_r(R+k_3); Rd = Rd + (1/6)*(k_1+2*k_2+2*k_3+k_4); Vv(i,:) = Rd; R = R + Rd*dt; t = t+dt; i = i+1; end rn = (Rv(:,1).^2+Rv(:,2).^2+Rv(:,3).^2).^0.5; % Radius Vector vn = (Vv(:,1).^2+Vv(:,2).^2+Vv(:,3).^2).^0.5; % Speed Vector fprintf('Distance from Earth center = %4.2f [km] \n',norm(R)); fprintf('Satellite speed= %4.4f [km/s] \n',norm(Rd));

Distance from Earth center = 77061.78 [km] Satellite speed= 1.5791 [km/s]

Plots

figure(1); hold on;grid on; plot(tv/3600,rn); ylabel('Altitude [km]'); xlabel('Time [hour]'); title('Distance variation of the satellite from the center of the Earth'); figure(2); hold on;grid on; plot(tv/3600,vn); ylabel('Speed [km/s]'); xlabel('Time [hour]'); title('Satellite speed variation');

## Two Body Problem Numerical Solution,Satellite – Earth

Given initial position and velocity of an earth orbiting satellite at a given instant.In this example we will numerically solve fundamental equation of relative two-body motion to find the maximum altitude(apogee altitude) reached by the satellite.

clc; clear all; R0 = [3102 5369 2625]; %[km] V0 = [-6.426 0.7735 5.943]; %[km/s] r = norm(R0); % Initial radius [km] v = norm(V0); % Initial speed [km/s] mu = 398600; % Earth’s gravitational parameter [km^3/s^2] a = mu/(2*mu/r - v^2); % Semimajor Axis [km] T = 2*pi*a^1.5/mu^0.5; % Orbital period [s] R_earth = 6378; % Earth radius [km] dt = T/1000; % time step [s] t = 0; % initial time % Using fourth-order Runge–Kutta method to solve fundamental equation % of relative two-body motion F_r = @(R) -mu/(norm(R)^3)*R; Rd = V0; R = R0; i = 1; while (t <= T) Rv(i,:) = R; tv(i) =t; k_1 = dt*F_r(R); k_2 = dt*F_r(R+0.5*k_1); k_3 = dt*F_r(R+0.5*k_2); k_4 = dt*F_r(R+k_3); Rd = Rd + (1/6)*(k_1+2*k_2+2*k_3+k_4); R = R + Rd*dt; t = t+dt; i = i+1; end rn = (Rv(:,1).^2+Rv(:,2).^2+Rv(:,3).^2).^0.5; Alt = rn - R_earth; % Altitude Vector Alt_max = max(Alt); % [km] fprintf('Maximum Altitude = %4.2f [km] \n',Alt_max);

Maximum Altitude = 6249.10 [km]

Ploting the altitude variation during one orbit

figure(1); hold on;grid on; plot(tv/3600,Alt); ylabel('Altitude [km]'); xlabel('Time [hour]'); title('Satellite altitude variation during one orbit');