Week 3 Homework Practice Ch3

Version/Date: Oct 3, 2017

Exercise

PREDICT_400-DL_SEC56 Wk3

File(s)

Homework.ipynb


In [20]:
import numpy as np
import matplotlib.pyplot as plt

# Use python functions to define my linear functions to plot
def f1(x):
    #return (1/2) * x + 2
    #return -4 + (2/3)*x
    return 18-(3/2)*x

def f2(x):
    #return np.sin(2*np.pi*x)
    return 12-(2/5)*x

def f3(x):
    #return -2 * x + 4
    return 8 + 0*x

x1 = np.arange(0, 12.0, 0.1)
x2 = np.arange(0, 12.0, 0.1)
x3 = np.arange(0, 10.0, 0.1)


plt.figure(1)
plt.grid(b='on', which='major', axis='both')
#plt.subplot(211)
#plt.plot(t1, f1(t1), 'bo', t2, f(t2), 'k')
#plt.subplot(212)
plt.plot(x1, f1(x1), 'b', x2, f2(x2), 'r', x3, f3(x3), 'g')
plt.show()



In [ ]:


In [ ]: