Created
December 28, 2017 07:15
-
-
Save RicherMans/ef7dcabd9f64ab61a99fa065697767dc to your computer and use it in GitHub Desktop.
Assignment2 DSP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy import signal | |
| import numpy as np | |
| def pitohz(x): | |
| return x/(np.pi*2) | |
| def prototype_filter(): | |
| """ ASSIGNMENT 2 | |
| Compute the prototype filter used in subband coding. The filter | |
| is a 512-point lowpass FIR h[n] with bandwidth pi/64 and stopband | |
| starting at pi/32 | |
| You should use the remez routine (signal.remez()). See | |
| http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.remez.html | |
| """ | |
| # In put is in hz, thus need to be converted to the right scale | |
| # Output is a passband at 0,pi/64 with gain 2 | |
| # And a stop band at pi/32 -> pi | |
| # Your code goes here | |
| return signal.remez(512, [0.0, pitohz(np.pi/64.), pitohz(np.pi/32.), pitohz(np.pi)], [2.0, 0.0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment