Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 19, 2015 01:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lettergram/94faae9adb1d0c6c8ed0 to your computer and use it in GitHub Desktop.
import numpy
import pylab
A = .1
w = 0.25
T = 1
t = 2
while (t > 0.0):
x = numpy.arange(0.0, 1.0+0.01, 0.01)
s = A*numpy.cos(((((2*numpy.pi)/w)*(x)) - ((2*numpy.pi)/T)*t))
pylab.plot(x, s)
pylab.ylim(ymax = .15, ymin = -.15)
pylab.xlabel('Postion')
pylab.ylabel('Amplitude')
pylab.title('Cosine Function')
pylab.grid(True)
pylab.savefig("plot_%.2f.png" %t)
t = (t - 0.1)
pylab.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment