程序
x=[4,3,2,1,0]
N = length(x)
n = [0:N-1]
k = [0:N-1]
w = exp(-j*2*pi/N)
nk = n' * k
wnk = w.^(nk)
Xk = x * wnk
结果
x =
4 3 2 1 0
N =
5
n =
0 1 2 3 4
k =
0 1 2 3 4
w =
0.3090 - 0.9511i
nk =
0 0 0 0 0
0 1 2 3 4
0 2 4 6 8
0 3 6 9 12
0 4 8 12 16
wnk =
1.0000 1.0000 1.0000 1.0000 1.0000
1.0000 0.3090 - 0.9511i -0.8090 - 0.5878i -0.8090 + 0.5878i 0.3090 + 0.9511i
1.0000 -0.8090 - 0.5878i 0.3090 + 0.9511i 0.3090 - 0.9511i -0.8090 + 0.5878i
1.0000 -0.8090 + 0.5878i 0.3090 - 0.9511i 0.3090 + 0.9511i -0.8090 - 0.5878i
1.0000 0.3090 + 0.9511i -0.8090 + 0.5878i -0.8090 - 0.5878i 0.3090 - 0.9511i
Xk =
10.0000 2.5000 - 3.4410i 2.5000 - 0.8123i 2.5000 + 0.8123i 2.5000 + 3.4410i