Exercise: Plotting a series 1

4.4.1. Exercise: Plotting a series 1#

Using a video camera, you recorded the position of a sprinter each 2 seconds. The recorded data are:

t = [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0]  # seconds
p = [0.0, 8.9, 28.0, 45.2, 60.4, 67.4, 75.5, 86.2, 93.0, 95.3, 100.0]  # meters

Write a code that produce this figure:

_images/16f1223b040dd666da37d067a1137356c17b4a057a4cedba3cbcd8e74ee44c52.png
Hide code cell content
import matplotlib.pyplot as plt


plt.plot(t, p)
plt.title("Race profile of a sprinter")
plt.xlabel("Time (s)")
plt.ylabel("Position (m)")
plt.grid(True);