View Full Version : Error in FREQRESP_Z?

03-13-2009, 09:04 AM
I posted this yesterday, but it looks like it got deleted.

There appears to be an error in FREQRESP_Z whenever the keyword NPOINTS is greater than the filter length. FREQRESP_Z chooses a different NPOINTS to calculate the result, but does not go back and recalculate OUTFREQ with the new NPOINTS.

h = firdesign(400, 0.1, /lowpass)
result1 = freqresp_z(h, 1000, outfreq=f1)
result2 = freqresp_z(h, 100, outfreq=f2)
; %%%FREQRESP_Z: Using 400 points.
!P.Multi = [0, 1, 2]
plot, f1, abs(result1), xtitle='Frequency (Hz)', ytitle='Magnitude', xrange=[0,1]
plot, f2, abs(result2), xtitle='Frequency (Hz)', ytitle='Magnitude', xrange=[0,1]

This bug should be fixed, but until then you can supply the /SLOW keyword for a workaround.

03-30-2009, 11:04 AM
Bump. Any response to the above post?

04-06-2009, 11:30 AM
Can someone from VNI verify that this is in fact an error and that it will be fixed? Thanks.

04-06-2009, 04:51 PM
thanks for the concise description hcrisp;
you are correct that it is a bug,
and i have filed the change-request to have it fixed;

04-09-2009, 03:57 PM
Hello hcrisp,

The fix for this problem will be available in the next full release of PV-WAVE.
If you are currently on maintenance you may contact Technical Support to
get the fix prior to the next release.

Visual Numerics Technical Support

06-10-2009, 01:50 PM
I detected what appears to be another bug in FREQRESP_Z. When you use the SLOW keyword, the phase response is incorrectly returned with a positive slope instead of a negative one (i.e., it should be constant delay but it looks like constant lead -- an impossibility).

!P.Multi = [0, 1, 2]

h = firdesign(101, 0.1, /lowpass)
r1 = freqresp_z(h, outfreq=f1)
r2 = freqresp_z(h, outfreq=f2, /SLOW)
plot, f1, arg(r1), xtitle='Frequency (Hz)', ytitle='Phase'
plot, f2, arg(r2), xtitle='Frequency (Hz)', ytitle='Phase'

Or I am I calling it wrong?

06-14-2009, 05:45 PM
correct again, this is a bug;
it is fixed now though, and the fix will be in the next full release of pv-wave;