Fortran Calculating Orbits: Finding Satellite Distance from Earth

AI Thread Summary
The discussion focuses on calculating satellite orbits using polar coordinates, specifically the formula r=p/(1-e*cos(theta)), where parameters include p=1200 km and varying eccentricities (e). A program is being developed to compute the satellite's distance from Earth based on user inputs for e and theta. Participants suggest using XMGRACE for plotting results and provide guidance on writing output to .dat files in Fortran. Additionally, there are inquiries about comparing floating point operations between different programs and plotting those comparisons. The conversation emphasizes practical coding solutions and plotting techniques in Fortran for orbital calculations.
kathrynag
Messages
595
Reaction score
0
I am doing a problem with calculating orbits.
The orbit can be expressed in polar coordinates as r=p/(1-ecos(theta)) where r and theta are the distance and angle of the satellite from the center of the earth, p is a paremter where p=1200 km, and e is a parameter representing eccentricity.
I'm supposed to write a program to calculate the distance of the satellite from the Earth as a function of theta if the satellite has an eccentrity of 0, .25, .5, .75, and 1.
Write the program to input values of e and theta. Here is what I have done:

program calculating_orbits
implicit none
real :: r !distance of the satellite from the center of the earth
real :: theta !angle of the satellite from the center of the earth
real, parameter :: p=1200 !parameter specifying the size of the orbit
real :: e !parameter specifying the eccentricity of the orbit
write (*,*) 'This program accepts inputs of theta and e and outputs the
+ value of r=p/(1-e*cos(theta)).'
write (*,*) 'This program will run until a number not in the domain
+ is inputted.'
do
write (*,*) 'Please input a real number.'
read (*,*) e
read (*,*) theta
Now I get stuck. Any hints?
 
Technology news on Phys.org
r=p/(1-e*cos(theta))
can you try to write this in fortran and print r as your result?
 
Few questions in fortran :)
1. Which is the best plotting tool in fortran
2. How to get out put in form of .dat files in fortran
3. Can anyone post a code for calculating floating point operations and finally plotting it..I read so many papers i never able to understand how they plot those
 
akshaythegeek said:
1. Which is the best plotting tool in fortran
If you're using *NIX, you can use XMGRACE. Typically I just write a file which can be easily read into Excel.

2. How to get out put in form of .dat files in fortran
You can write in any form you want. I don't understand.

3. Can anyone post a code for calculating floating point operations and finally plotting it..I read so many papers i never able to understand how they plot those
Code:
OPEN(11,file='output_file.dat',form='formatted')
DO i=1,10
  x = REAL(i)
  y = x**2
  WRITE(11,*) x,y
END DO
CLOSE(11)
 
What about calculating floating point operation, suppose i have a mac and i am running a program then how to compare two programs ..how to plot graphs between floating point operations ...between these two programs
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top