Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
nanobiolog committed Sep 18, 2022
1 parent 573e347 commit 06b3745
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions orbit.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#calculate orbital values of an object by using input from the user and show in the 3d graph

import math
import time
import sys
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

def orbital_values():
#get input from user
print("Enter the orbital period in seconds: ")
orbital_period = float(input())
print("Enter the orbital radius in meters: ")
Expand Down Expand Up @@ -35,19 +32,19 @@ def orbital_values():
print("Orbital Force: ", orbital_force)
print("Orbital Energy: ", orbital_energy)

#calculate the orbital position in 3d graph
#calculate the orbital position
#set the x, y and z axis
x = []
y = []
z = []

#calculate the orbital position in 3d graph
#calculate the orbital position
for i in range(0, 100):
x.append(orbital_radius * math.cos(i))
y.append(orbital_radius * math.sin(i))
z.append(0)

#plot the 3d graph
#3d graph
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(x, y, z, label='orbital position')
Expand All @@ -56,7 +53,6 @@ def orbital_values():
ax.set_zlabel('Z axis')
plt.show()

#call the function
orbital_values()


Expand Down

0 comments on commit 06b3745

Please sign in to comment.