Created
November 1, 2013 08:23
-
-
Save ibanezmatt13/7262376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PROBLEM 1 | |
# | |
# Modify the orbit function below to model | |
# one revolution of the moon around the earth, | |
# assuming that the orbit is circular. | |
# | |
# Use the math.cos(angle) and math.sin(angle) | |
# functions in order to accomplish this. | |
import math | |
from udacityplots import * | |
moon_distance = 384e6 # m | |
def orbit(): | |
num_steps = 50 | |
x = numpy.zeros([num_steps + 1, 2]) | |
###Your code here. | |
return x | |
x = orbit() | |
@show_plot | |
def plot_me(): | |
matplotlib.pyplot.axis('equal') | |
matplotlib.pyplot.plot(x[:, 0], x[:, 1]) | |
axes = matplotlib.pyplot.gca() | |
axes.set_xlabel('Longitudinal position in m') | |
axes.set_ylabel('Lateral position in m') | |
plot_me() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment