Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction on Chapter 5 test functions #72

Closed
necronet opened this issue Jul 29, 2020 · 1 comment
Closed

Correction on Chapter 5 test functions #72

necronet opened this issue Jul 29, 2020 · 1 comment

Comments

@necronet
Copy link

necronet commented Jul 29, 2020

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
@AllenDowney
Copy link
Owner

Will fix. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants