AllenDowney / ThinkDSP

Think DSP: Digital Signal Processing in Python, by Allen B. Downey.
https://allendowney.github.io/ThinkDSP/
3.97k stars 3.23k forks source link

7.6 effiicient analysis #58

Closed ShmuelBenEzra closed 5 years ago

ShmuelBenEzra commented 6 years ago

def analyze2(ys, fs, ts)

N is not defined

AllenDowney commented 5 years ago

You are right. There is a simpler version of this function in the most recent version of the book:

def analyze2(ys, fs, ts):
    args = np.outer(ts, fs)
    M = np.cos(PI2 * args)
    amps = np.dot(M, ys) / 2
    return amps

No need for N, so it avoids the issue.