For my dynamics course I am tasked with writing a python code that will plot the trajectory of a position vector from when it starts on the ground to when it lands on the ground. I currently have my code create a linear space from the two zero values that I calculated by hand, but I want to code that in. Because I also need to create velocity vectors on the trajectory, I have the position vector broken into its x and y components. I have looked into xlim and this thread, but couldn't figure out how to implement them. I'm fairly new to python and coding in general, so I'm still trying to learn how things work.
import numpy as np
import matplotlib.pyplot as plt
#creates a function that returns the x component
def re10(x):
r1 = 0.05*x
return r1
#creates a function that returns the y component
def re20(x):
r2 = -4.91*(x**2) + 30*x + 100
return r2
#Calculates the two zeroes of the trajectory
tmin = (-30 + np.sqrt(30**2 -4*-4.91*100))/(2*-4.91)
tmax = (-30 - np.sqrt(30**2 -4*-4.91*100))/(2*-4.91)
#Initializing time space
t = np.linspace(tmin, tmax, 100)
#Plot
plt.plot(re10(t), re20(t)) #(x, y)