[SciPy-user] scipy.signal.firwin

Tom K. tpk@kraussfamily....
Sat Mar 21 12:46:14 CDT 2009

Bugzilla from ndbecker2@gmail.com wrote:
> Jan Rauberg wrote:
>> Lev Givon <lev <at> columbia.edu> writes:
>>> If you want to create a high-pass filter, just specify the cutoff to
>>> firwin and flip the signs of the obtained coefficients, i.e.,
>>> b = -firwin(N,cutoff)
>>> L.G.
>> Thank you for the fast response. But in the way as you described I get an
>> inverted low pass figure. That's not a high pass and no solution for my
>> problem too. Perhaps there is another solution? J.R.
> A trivial (not ideal) solution is G(z) = 1-H(z)

Simple inversion won't do the trick - you can invert the spectrum as Jan
suggests, or shift the entire spectrum by pi radians.


from scipy import signal
import numpy as np

h=signal.firwin(11, .3)
n=np.arange(-(N/2), (N/2)+1)

1) spectrum inversion G(z) = 1-H(z)
How: Subtract original filter from a kronecker delta function.

2) shift entire spectrum by pi radians
How: Elementwise multiply by (-1)**n

The resulting highpass filters will have different characteristics:
 g is complementary filter to h (bandwidth is pi-bandwidth(h))
 g1 has same bandwidth as h

These techniques won't work for even length filters, but you probably won't
want an even length highpass filter anyway because of the null at pi

  - Tom K.

View this message in context: http://www.nabble.com/scipy.signal.firwin-tp22587139p22638541.html
Sent from the Scipy-User mailing list archive at Nabble.com.

More information about the SciPy-user mailing list