FFT
To download presentation about FFT click here
from cmath import*
x=[1,2,3,4]
N = len(x)
s = 0
fft=[]
for k in range(N):
for n in range(N):
s+=x[n]*exp(-2*pi/N*n*k*1j)
fft.append(s)
s=0
print fft
x=[1,1-1j,-1,1+1j]
N = len(x)
s = 0
fft=[]
for k in range(N):
for n in range(N):
s+=1.0/N*x[n]*exp(2*pi/N*n*k*1j)
fft.append(s)
s=0
print fft
Python Code of problem 4.16 S.S.Sastry
from cmath import*
x=[1,2,3,4]
N = len(x)
s = 0
fft=[]
for k in range(N):
for n in range(N):
s+=x[n]*exp(-2*pi/N*n*k*1j)
fft.append(s)
s=0
print fft
Python Code of problem 4.17 S.S.Sastry
from cmath import*x=[1,1-1j,-1,1+1j]
N = len(x)
s = 0
fft=[]
for k in range(N):
for n in range(N):
s+=1.0/N*x[n]*exp(2*pi/N*n*k*1j)
fft.append(s)
s=0
print fft
Comments
Post a Comment