Fourier Series-Square Wave

#Fourier Series - Square Wave Arfken
from pylab import *
h=2
x=linspace(-3*pi,3*pi,1000)
term=h/2.0
n=input('Enter the number of terms in series to be taken: ')
for i in range(n):
    term=term+2*h/pi*sin((2*i+1)*x)/(2*i+1)
plot(x,term)
show()

Comments