Question
Y(t)vot gt for vo 10,9 9.81 3. Make a plot of the function and [O, 2vo/gl. Set the axes labels as…
Please answer using Python Pycharm programming.
y(t)vot gt for vo 10,9 9.81 3. Make a plot of the function and [O, 2vo/gl. Set the axes labels as time (s) and height (m). 4. Create an array W with values 0, 0.1, 0.2, …., 3. Write out WI:], WI:-2], W[:5], W[2:-2:6] Convince yourself in each case that you understand which elements of the array that are printed.
Solutions
Expert Solution
Code:
3.
import numpy as np
import matplotlib.pyplot as plt
vo = 10
g = 9.81
t = np.arange(0, 2*vo/g,0.1)
y = vo*t- (g*t*t)/2
plt.plot(t,y)
plt.xlabel('time(s)')
plt.ylabel('height(m)')
Output:
4.
import numpy as np
W = np.arange(0, 3.1,0.1)
print(W[:]) #print all elements of W
print(W[:-2]) # prints all elements except last 2
print(W[::5]) #print all elements at step size of 5
print(W[2:-2:6]) #prints from index 2 till length(W) – 2 with a
step of 6
Output: