def f(t): return np.exp(-t) * np.cos(2*np.pi*t) 

Suppose you are trying to plot the function

f(t) = e^{-t}cos(2 \pi t) \bold{vs} \ t

several times in the same code and you would like not to have to rewrite it every single time. You can define it as a function in your code as we learned in Lab03 .
  t1 = np.arange(0.0, 5.0, 0.1) t2 = np.arange(0.0, 5.0, 0.02) 

• Define an array t1 (using arange)that ranges between 0 and 5 with 0.1 steps between the data points.
• Define an array t2 (using arange)that ranges between 0 and 5 with 0.2 steps between the data points.
  # numrows, numcols, fignum plt.subplot(3,1,1) 

Here you are trying to plot 3 sub plots in one figure. To do that you need to call the function subplot. The function subplot has three arguments.
• The first is the total number of rows you will divide your figure by.
• The second is the total number of columns you will divide you figure by.
• The third is the subplot number.
In this case we want 3 subplot in a one columns.

To Fill the first sub-plot:
  plt.plot(t1, f(t1), 'bo') plt.ylabel('f(t)') plt.xlabel('t') 

• plotting t1 array on the x-axis and f(t1) on the y-axis with blue circles markers.
• label the y-axis
• label the x-axis

To Fill the second sub-plot:
  plt.subplot(3,1,2) plt.plot(t2, f(t2), 'k') plt.ylabel('f(t)') plt.xlabel('t') 

• plotting t2 array on the x-axis and f(t2) on the y-axis using a black line.
• label the y-axis
• label the x-axis

To Fill the third sub-plot:
  plt.subplot(3,1,3) plt.plot(t1, f(t1), 'r--') plt.ylabel('f(t)') plt.xlabel('t') 

• plotting t1 array on the x-axis and f(t1) on the y-axis with blue circles markers using a red dashed line.
• label the y-axis
• label the x-axis
  plt.show() 

show displays the plot on the computer screen. No screen output is produced before this function is called.