Anda di halaman 1dari 6

Manalese, Glenn Matthew G.

2011-01573
CE 27 FL1
Mr. Maxell Lumbera
Machine Problem 1
I. Introduction
Interception and rendezvous of vehicles orbiting the Earth has been performed to
deliver supplies to manned spacecrafts or to repair or upgrade an existing space-
equipment. In this machine problem, we were asked to solve for the eccentricity of
the new hyperbolic orbit of a vehicle in order to intercept a second vehicle which was
leading it. In this case, the two vehicles were initially orbiting a same circular orbit.
To solve for the eccentricity, we should find a solution to this transcendental
equation:



(


))
where

is the angle difference between vehicles 1 and 2, and

is the angle difference between vehicle 2 and the point of interception.


II. Objectives
The primary objectives for this activity would be to:
Create a program that would ask the user to input to the values for

and

.
Compute the value of from the input.
Solve for the value of e using the input data and using any root-finding
methods (but for this activity, the secant method was used).
Print the result on the program window or on a text file.
III. Methodology
First, the stdio.h, stdlib.h, and math.h header files which will were crucial for the
program were included into the program. Then, the equations and constants which
were needed to solve for e were defined.
# include <stdio.h>
# include <stdlib.h>
# include <math.h>
# define ThetaFinder(phi12, phi23) ((phi12+phi23)/2.0)
# define pi 3.141592654
# define EFinder(e, theta,phi23) (sqrt(pow((1+e*cos(theta))/(e*e-1), 3))*((e*sqrt(e*e-
1)*sin(theta))/(1+e*cos(theta))-log((sqrt(e+1)+sqrt(e-1)*tan(theta/2.0))/((sqrt(e+1)-sqrt(e-
1)*tan(theta/2.0)))))-pi*phi23/360.0)
# define epsilon 0.000001
In the main function, the variables and file pointer that will be used later were
initialized. Then, the program scans for the users input values of

and

, which
will be used to solve for the value of .
double theta, phi12, phi23, e, e1, e2, y1, y2, phi23deg, phi12deg;
FILE*output;
output=fopen("output.txt", "w");
printf("Input value for phi_12 in degrees:\n");
scanf("%lf", &phi12);
phi12deg=phi12;
phi12=phi12*pi/180.0;
printf("Input first value for phi_23 in degrees:\n");
scanf("%lf", &phi23);
phi23deg=phi23;
phi23=phi23*pi/180.0;
theta=ThetaFinder(phi12, phi23);
Then, the value of e will be solved by the program using the secant method, which
requires two arbitrary values for e. And then, the value of e will be printed on the
output file.
e1=1.0001;
e2=1.0002;
e= 2;
while(fabs(EFinder(e, theta, phi23deg))>epsilon){
e= e2 - EFinder(e2, theta, phi23deg)/((EFinder(e2, theta, phi23deg)-EFinder(e1, theta,
phi23deg))/(e2-e1));
e1=e2;
e2=e;
}
printf("phi_12 = %lf\tphi_23 = %lf\t e = %lf\n", phi12deg, phi23deg, e);
fprintf(output, "phi_12 = %lf\tphi_23 = %lf\t e = %lf\n", phi12deg, phi23deg, e);
The process of requiring input from the user and solving for e is repeated three more
times since the activity requires 4 values of e to be solved.
IV. Results and Discussion
With the input values set to

and

these
were written on the output file of the program.
phi_12 = 30.000000 phi_23 = 20.000000 e = 4.479545
phi_12 = 30.000000 phi_23 = 30.000000 e = 2.397025
phi_12 = 30.000000 phi_23 = 40.000000 e = 1.532575
phi_12 = 30.000000 phi_23 = 50.000000 e = 1.073447
By increasing the value of

, the value of e seem to approach 1 which indicates


that the new orbit of vehicle 2 becomes more linear.
V. Conclusion
The program was able to return values for the eccentricity of the hyperbolic path with
a margin of error of 0.000001. Therefore, the program can solve for the values of e
given the values of

and

. But, if the value of

is increased further, the


program was able to compute values less than 1 (which would be impossible, since it
would result into some complex numbers in the equation), making it a limitation of
the program.
VI. Appendix
Source code
# include <stdio.h>
# include <stdlib.h>
# include <math.h>
# define ThetaFinder(phi12, phi23)
((phi12+phi23)/2.0)
# define pi 3.141592654
# define EFinder(e, theta,phi23)
(sqrt(pow((1+e*cos(theta))/(e*e-1),
3))*((e*sqrt(e*e-
1)*sin(theta))/(1+e*cos(theta))-
log((sqrt(e+1)+sqrt(e-
1)*tan(theta/2.0))/((sqrt(e+1)-sqrt(e-
1)*tan(theta/2.0)))))-pi*phi23/360.0)
# define epsilon 0.000001

int main()
{

double theta, phi12, phi23, e, e1, e2,
y1, y2, phi23deg, phi12deg;
FILE*output;
output=fopen("output.txt", "w");

printf("Input value for phi_12 in
degrees:\n");
scanf("%lf", &phi12);

phi12deg=phi12;
phi12=phi12*pi/180.0;

printf("Input first value for phi_23 in
degrees:\n");
scanf("%lf", &phi23);

phi23deg=phi23;
phi23=phi23*pi/180.0;

theta=ThetaFinder(phi12, phi23);

e1=1.0001;
e2=1.0002;
e= 2;

while(fabs(EFinder(e, theta,
phi23deg))>epsilon){

e= e2 - EFinder(e2, theta,
phi23deg)/((EFinder(e2, theta,
phi23deg)-EFinder(e1, theta,
phi23deg))/(e2-e1));
e1=e2;
e2=e;

}

printf("phi_12 = %lf\tphi_23 = %lf\t
e = %lf\n", phi12deg, phi23deg, e);
fprintf(output, "phi_12 = %lf\tphi_23
= %lf\t e = %lf\n", phi12deg, phi23deg,
e);

printf("Input second value for phi_23
in degrees:\n");
scanf("%lf", &phi23);

phi23deg=phi23;
phi23=phi23*pi/180.0;

theta=ThetaFinder(phi12, phi23);

e1=1.0001;
e2=1.0002;
e= 2;

while(fabs(EFinder(e, theta,
phi23deg))>epsilon){

e= e2 - EFinder(e2, theta,
phi23deg)/((EFinder(e2, theta,
phi23deg)-EFinder(e1, theta,
phi23deg))/(e2-e1));
e1=e2;
e2=e;

}

printf("phi_12 = %lf\tphi_23 = %lf\t
e = %lf\n", phi12deg, phi23deg, e);
fprintf(output, "phi_12 = %lf\tphi_23
= %lf\t e = %lf\n", phi12deg, phi23deg,
e);

printf("Input third value for phi_23
in degrees:\n");
scanf("%lf", &phi23);

phi23deg=phi23;
phi23=phi23*pi/180.0;

theta=ThetaFinder(phi12, phi23);

e1=1.0001;
e2=1.0002;
e= 2;

while(fabs(EFinder(e, theta,
phi23deg))>epsilon){

e= e2 - EFinder(e2, theta,
phi23deg)/((EFinder(e2, theta,
phi23deg)-EFinder(e1, theta,
phi23deg))/(e2-e1));
e1=e2;
e2=e;

}

printf("phi_12 = %lf\tphi_23 = %lf\t
e = %lf\n", phi12deg, phi23deg, e);
fprintf(output, "phi_12 = %lf\tphi_23
= %lf\t e = %lf\n", phi12deg, phi23deg,
e);

printf("Input fourth value for phi_23
in degrees:\n");
scanf("%lf", &phi23);

phi23deg=phi23;
phi23=phi23*pi/180.0;

theta=ThetaFinder(phi12, phi23);

e1=1.0001;
e2=1.0002;
e= 2;

while(fabs(EFinder(e, theta,
phi23deg))>epsilon){

e= e2 - EFinder(e2, theta,
phi23deg)/((EFinder(e2, theta,
phi23deg)-EFinder(e1, theta,
phi23deg))/(e2-e1));
e1=e2;
e2=e;

}

printf("phi_12 = %lf\tphi_23 = %lf\t
e = %lf\n", phi12deg, phi23deg, e);
fprintf(output, "phi_12 = %lf\tphi_23
= %lf\t e = %lf\n", phi12deg, phi23deg,
e);

printf("Thank you for using this
program!\n");

return 0;

}

Anda mungkin juga menyukai