AllenDowney/ThinkDSP

Correction on Chapter 5 test functions

necronet opened this issue · 1 comments

A minor point on reading about Discrete cosine transform chapter, there are two test function describe to build an M matrix (see bellow). The amp array is not used in any of them so it should be remove to avoid confusion.

Source: https://github.com/AllenDowney/ThinkDSP/blob/master/code/chap06.ipynb

def test1():
    amps = np.array([0.6, 0.25, 0.1, 0.05])
    N = 4.0
    time_unit = 0.001
    ts = np.arange(N) / N * time_unit
    max_freq = N / time_unit / 2
    fs = np.arange(N) / N * max_freq
    args = np.outer(ts, fs)
    M = np.cos(PI2 * args)
    return M

def test2():
    amps = np.array([0.6, 0.25, 0.1, 0.05])
    N = 4.0
    ts = (0.5 + np.arange(N)) / N
    fs = (0.5 + np.arange(N)) / 2
    args = np.outer(ts, fs)
    M = np.cos(PI2 * args)
    return M
    
M = test2()
M

Will fix. Thank you!