[SciPy-User] [SciPy-user] help about lfilter ????

persia m.abdollahi@gmail....
Thu Jan 28 19:26:37 CST 2010


Thank you so much for what you pointed out, and I agree with you on automatic
type conversion.

persia
  

josef.pktd wrote:
> 
> On Thu, Jan 28, 2010 at 8:14 PM, David Cournapeau <cournape@gmail.com>
> wrote:
>> On Fri, Jan 29, 2010 at 10:10 AM,  <josef.pktd@gmail.com> wrote:
>>> On Thu, Jan 28, 2010 at 7:51 PM, persia <m.abdollahi@gmail.com> wrote:
>>>>
>>>> lfilter is the linear filtering function in the scipy.signal module.
>>>> can
>>>> someone tell me what is wrong with this function please ?
>>>>
>>>> I used this function in the following way and it gave me that error !!
>>>> :
>>>>
>>>> In [204]:
>>>> lfilter(array([1,2,3]),array([-4,5,6]),array([9,8,7,6,5,4,3,2,1]),zi=array([0,0]))
>>>> ---------------------------------------------------------------------------
>>>> <type 'exceptions.ValueError'>            Traceback (most recent call
>>>> last)
>>>>
>>>>
>>>>
>>>> <type 'exceptions.ValueError'>: linear_filter not available for this
>>>> type
>>>>
>>>>
>>>> why is it so ??!!!! what is wrong with this "type " ? what is it meant
>>>> by
>>>> this type anyway ?! i tried with the same arguments in matlab with the
>>>> corresponding function and it worked !!
>>>> and if i multiply the second argument vector say by .4, this will
>>>> happen :
>>>>
>>>> lfilter(array([1,2,3]),.4*array([-4,5,6]),array([9,8,7,6,5,4,3,2,1]),zi=array([0,0]))
>>>>
>>>>
>>>> (array([   -5.625     ,   -23.28125   ,   -68.7890625 ,  -148.40820312,
>>>>        -312.44384766,  -633.16711426, -1276.37466431, -2557.71900177,
>>>>       -5120.46074867]),
>>>>  array([-10242.1544385 ,  -7682.56612301]))
>>>>
>>>>
>>>> see ? no problem then ?!! isnt this wierd ? please help !
>>>
>>> it looks like lfilter doesn't like integers
>>
>> Yes - the error message could be improved at least.
>>
>> Integers are not supported as is because the difference equation
>> requires division (for IIR). I wonder whether it would make sense to
>> automatically convert to floating point if everything is integer.
> 
> Yes, I would think so, if it doesn't work or doesn't make sense with
> integers than automatic conversion is the best in these cases, e.g.
> fftconvolve, np.mean, ...
> 
> Josef
> 
>>
>> cheers,
>>
>> David
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
> 
> 

-- 
View this message in context: http://old.nabble.com/help-about-lfilter------tp27363601p27365988.html
Sent from the Scipy-User mailing list archive at Nabble.com.



More information about the SciPy-User mailing list