import numpy as np
from numpy import math
import matplotlib.pyplot as plt
t = np.arange(0, 10, 0.005)
x = np.sin(2 * np.pi * t)
f = 30 * (np.random.rand(t.size) + 0.225)
N = t.size
i = 1j
W = np.exp(-2 * math.pi * i * np.dot(f.reshape(N, 1), t.reshape(1, N)))
X = np.dot(W, x.reshape(N, 1))
out = X.reshape(f.shape).T
plt.plot(f, out, 'ro')
Issues Translating Custom Discrete Fourier Transform from MATLAB to Python