PDA

View Full Version : problem with IIRFILT



hcrisp
06-11-2009, 04:27 PM
I get an error while trying to filter a signal with IIRFILT. It works fine for a single pass, but fails for forward-backward filtering. I am building an exponential average filter structure like so:



h = FILTSTR(NAME='IIR', [0.05], [1., -(1-0.05)])

x = randomu(s, 2000)
y = IIRFILT(h, x)
; works fine!

y = IIRFILT(h, x, /FORWARD_BACK)
%%%ROTATE: Expression must be an array in this context: A.
%%%Execution halted at REVERSE <reverse.pro( 37)> (ROTATE).
%%%Called from IIRFILT <iirfilt.pro( 79)>.
%%%Called from $MAIN$ .


I think it has to do with the fact that the numerator has only one coefficient. It works if you add a zero. Funny thing is, an FIR with only one denominator coefficient works fine.



h = FILTSTR(NAME='IIR plus 1', [0.05, 0.], [1., -(1-0.05)])

x = randomu(s, 2000)
y = IIRFILT(h, x, /FORWARD_BACK)
; works fine!

h = FILTSTR(NAME='FIR', [1.,1.,1.], [3.])
y = IIRFILT(h, x, /FORWARD_BACK)
; works fine!


Is this a bug?

allan
06-12-2009, 07:03 PM
you are correct, this is a bug;
it is fixed as of now though,
and the fix will appear in the next full release of pv-wave;