Last active
January 3, 2018 13:33
-
-
Save tommyct614/3c3fa0479a9da926cf3db7e7b3e3e979 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
xmin = 0 #xmin and xmax can be changed for different intervals | |
xmax = 2*(np.pi) #np.pi is the value of pi in numpy | |
N = 201 | |
x = np.linspace(xmin,xmax,N) | |
y = np.zeros(len(x)) | |
x2 = np.linspace(xmin,xmax,N) | |
y2 = np.zeros(len(x2)) | |
for i in range(len(x)): | |
y[i] = np.sin(x[i]) | |
for b in range(len(x2)): | |
y2[b] = np.cos(x2[b]) | |
plt.plot(x,y,label="Sine") | |
plt.plot(x2,y2,label="Cos") | |
plt.xlabel("Angle in radians") | |
plt.ylabel("Sine/Cos") | |
plt.legend(loc=1) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment