3. Work on the following problem. Name it as P3.py You should be able to run it
ID: 3595268 • Letter: 3
Question
3. Work on the following problem. Name it as P3.py You should be able to run it as python P3.py 1 2.5 5, which will generate 3 curves on the same figure. (Hint, use the hold() function to plot multiple curves on the same figure) Plot a formula for several parameters. Make a program that reads a set of vo values from the command line and plots the corresponding curves y(t) = tot-05gt2 in the same figure (set g 9.81). Let t e [0,2v0/g) for each curve, which implies that you need a different vector of t coordinates for each curve.Explanation / Answer
import matplotlib.pyplot as plt
global g
g = 9.81
v0 = 1
def y(v):
upper = 2*v0/g
lower = 0
Range = []
for i in range(10):
Range.append(i*(upper/10.0))
result = []
for i in range(len(Range)):
t = Range[i]
result.append(v0*t - 0.5*g*t**2)
return result
plt.plot(y(v0),v0)
plt.show()
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.