Sep-20-2017, 12:00 PM
This seems to be rather simple, but I am not getting there. I am trying to execute the math for Fourier transform. Here is the code I wrote
x1,x2,x3,x4 when fn=1
--------------
x1,x2,x3,x4 when fn=3
what I get instead is the sum as follows
Appreciate any suggestions
import numpy as np x=[1,2,3,4] # my data values fn=np.arange(0,len(x),dtype=np.float) for k in fn: for xi in x: print(k) print(xi) xx=np.sum(xi*(np.exp(-1j*2.0*3.14*fn/len(x)))) print(xx)What I need id the sum for the x1,x2,x3,x4 when fn = 0
x1,x2,x3,x4 when fn=1
--------------
x1,x2,x3,x4 when fn=3
what I get instead is the sum as follows
Appreciate any suggestions
Output:nuncio
0.0
1
(-0.00159138312909-0.0015951894606j)
0.0
2
(-0.00318276625818-0.00319037892121j)
0.0
3
(-0.00477414938726-0.00478556838181j)
0.0
4
(-0.00636553251635-0.00638075784241j)
1.0
1
(-0.00159138312909-0.0015951894606j)
1.0
2
(-0.00318276625818-0.00319037892121j)
1.0
3
(-0.00477414938726-0.00478556838181j)
1.0
4
(-0.00636553251635-0.00638075784241j)
2.0
1
(-0.00159138312909-0.0015951894606j)
2.0
2
(-0.00318276625818-0.00319037892121j)
2.0
3
(-0.00477414938726-0.00478556838181j)
2.0
4
(-0.00636553251635-0.00638075784241j)
3.0
1
(-0.00159138312909-0.0015951894606j)
3.0
2
(-0.00318276625818-0.00319037892121j)
3.0
3
(-0.00477414938726-0.00478556838181j)
3.0
4
(-0.00636553251635-0.00638075784241j)