[SciPy-dev] accuracy problem in filterdesign.py

Heiko Henkelmann heiko at hhenkelmann.de
Sun Mar 24 15:38:32 CST 2002


while writing a test driver for a minimum phase calculation routine I came
across the following problem. It is causing asymmetriesin the output of
freqz. In line 107 and 109 in filter_design.py the follwoing is happening:

>>> N=512
>>> lastpoint=2*pi
>>> w1=arange(0,lastpoint,lastpoint/N)
>>> w2=arange(0,N)*(lastpoint/N)
>>> lastpoint-w1[511]-w1[1]
>>> lastpoint-w2[511]-w2[1]
>>> w1[511]
>>> w2[511]
>>> w2[511]-w1[511]

It appears that arange for floating point values is accumulating an error
during summation. Do you think it would be worthwhile to tweak
filter_design.py to work around this problem?


More information about the Scipy-dev mailing list