import numpy as np
import matplotlib.pyplot as plt

N = 64
k0 = 7
x = np.exp(1j * 2 * np.pi * k0 / N * np.arange(N))

#empty array
X = np.array([])

#iter over frequency sample
for k in range(N):
    #complex exponential
    s = np.exp(1j*2 * np.pi * k / N * np.arange(N))
    # compute output spectrum
    X = np.append(X, sum(x*np.conjugate(s)))
    
plt.plot(np.arange(N), abs(X))
plt.axis([0, N-1, 0, N])

plt.show()

12e1e39d752e39978061ce9a39f4faaa67d9c5a2
<mask token>

<mask token>
for k in range(N):
    s = np.exp(1.0j * 2 * np.pi * k / N * np.arange(N))
    X = np.append(X, sum(x * np.conjugate(s)))
plt.plot(np.arange(N), abs(X))
plt.axis([0, N - 1, 0, N])
plt.show()

<mask token>
N = 64
k0 = 7
x = np.exp(1.0j * 2 * np.pi * k0 / N * np.arange(N))
X = np.array([])
for k in range(N):
    s = np.exp(1.0j * 2 * np.pi * k / N * np.arange(N))
    X = np.append(X, sum(x * np.conjugate(s)))
plt.plot(np.arange(N), abs(X))
plt.axis([0, N - 1, 0, N])
plt.show()

import numpy as np
import matplotlib.pyplot as plt
N = 64
k0 = 7
x = np.exp(1.0j * 2 * np.pi * k0 / N * np.arange(N))
X = np.array([])
for k in range(N):
    s = np.exp(1.0j * 2 * np.pi * k / N * np.arange(N))
    X = np.append(X, sum(x * np.conjugate(s)))
plt.plot(np.arange(N), abs(X))
plt.axis([0, N - 1, 0, N])
plt.show()

import numpy as np
import matplotlib.pyplot as plt

N = 64
k0 = 7
x = np.exp(1j * 2 * np.pi * k0 / N * np.arange(N))

#empty array
X = np.array([])

#iter over frequency sample
for k in range(N):
    #complex exponential
    s = np.exp(1j*2 * np.pi * k / N * np.arange(N))
    # compute output spectrum
    X = np.append(X, sum(x*np.conjugate(s)))
    
plt.plot(np.arange(N), abs(X))
plt.axis([0, N-1, 0, N])

plt.show()
