[SciPy-User] firwin behavior

Jeff Alstott jeffalstott at gmail.com
Wed Aug 10 09:14:59 EDT 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);
savefig('FIR21_filter80.png')

Produces the attached file.

In contrast, Matlab:

Trial>> ny = 500

ny =

   500

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.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110810/41916ba9/attachment.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.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-0001.png>


More information about the SciPy-User mailing list