[SciPy-User] firwin behavior

Jeff Alstott jeffalstott@gmail....
Wed Aug 10 08:14:59 CDT 2011

firwin is producing unreasonable filters for me, and I'm not sure if I'm
misusing the code or if there is a bug. Like so:

In [5]: from scipy.signal import firwin

In [6]: ny = 500

In [7]: f21f80= firwin(21, [1/ny, 80/ny]); plot(f21f80);

Produces the attached file.

In contrast, Matlab:

Trial>> ny = 500

ny =


Trial>> [f20f80] = fir1(20, [1/ny, 80/ny]); figure; plot(f20f80)

Produces the other attached file. Quite different! The filter produced by
the scipy function, if used with lfilter (or if taken to Matlab to use as a
filter), produces a nonsense filtering, with many high frequency artifacts.

Any thoughts? This is in python3, if that matters.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110810/41916ba9/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FIR21_filter80.png
Type: image/png
Size: 16858 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20110810/41916ba9/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matlab_FIR21_filter80.png
Type: image/png
Size: 8402 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20110810/41916ba9/attachment-0003.png 

More information about the SciPy-User mailing list