Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- t = np.linspace(-2, 2, 100) # choose 100 points in a time interval
- f_values = t**2
- g_values = np.exp(t)
- plt.plot(t, f_values, 'r', t, g_values, 'b--')
- plt.xlabel('t')
- plt.ylabel('f and g')
- plt.legend(['t**2', 'e**t'])
- plt.title('Plotting Two Functions (t**2 and e**t)')
- plt.grid('on')
- plt.axis([-3, 3, -1, 10])
- plt.show()
- # page 24 and 25 of Programming for Computations
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement