[SciPy-User] firwin behavior
Wed Aug 10 15:16:06 CDT 2011
On 8/10/2011 8:14 AM, Jeff Alstott wrote:
> 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 : from scipy.signal import firwin
> In : ny = 500
> In : f21f80= firwin(21, [1/ny, 80/ny]); plot(f21f80);
Is this a simple error, ny = 500 (integer) and 1/500 = 0, 80/500 = 0.
Simply create a float ny = 500. , Note the "." then the divides will be
floats. In Matlab everything is by default a double. Python not so.
The version I am running encounters an error on the above, if I use
floats or not, version 0.8.0.
> 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.
> SciPy-User mailing list
More information about the SciPy-User