Think DSP by Allen B. Downey

Think DSP by Allen B. Downey

Author:Allen B. Downey
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2016-07-26T16:00:00+00:00


# class Dct def make_wave(self): n = len(self.hs) ys = scipy.fftpack.idct(self.hs, type=2) / 2 / n return Wave(ys, framerate=self.framerate)

By default, the inverse DCT doesn’t normalize the result, so we have to divide through by 2N.

Exercises

For the following exercises, I provide some starter code in chap06starter.ipynb. Solutions are in chap06soln.ipynb.

Exercise 6-1.

In this chapter I claim that analyze1 takes time proportional to n3 and analyze2 takes time proportional to n2. To see if that’s true, run them on a range of input sizes and time them. In Jupyter, you can use the “magic command” %timeit.

If you plot run time versus input size on a log-log scale, you should get a straight line with slope 3 for analyze1 and slope 2 for analyze2.

You also might want to test dct_iv and scipy.fftpack.dct.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.