[SciPy-User] firwin behavior

Christopher Felton chris.felton@gmail....
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 [5]: from scipy.signal import firwin
>
> In [6]: ny = 500
>
> In [7]: 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.

Regards,
Chris

> 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!
>
>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list