freqz produces incorrect output
Ben Abbott
bpabbott at mac.com
Sat Jan 24 18:57:44 CST 2009
On Jan 14, 2009, at 1:17 AM, John W. Eaton wrote:
> On 24-Dec-2008, Ben Abbott wrote:
>
> |
> | On Dec 24, 2008, at 4:21 PM, Frederick_Umminger at playstation.sony.com
> | wrote:
> |
> | > I believe the following code fixes the problem. I apologize for it
> | > not being a diff.
> | >
> | > -Frederick
> |
> | I've attached a changeset attributed to you.
> |
> | Before being committed, I think a new test show be added.
> |
> | Fredrick can you propose a simple script that tests your change?
>
> Even with this patch, the phase plot looks strange. Is it correct?
>
> jwe
I look at a simple example.
freqz (ones (20, 1), 1, 512, "half", 2)
There are phase changes of 180 degrees at f=n*0.1. In addition there
is a linear phase superimposed due to the delay.
The linear part can be verified by
[h, f] = freqz (ones (20, 1), 1, 512, "half", 2);
median (-diff (angle (h)) ./ diff (f) / pi)
ans = 9.5
Which agrees with the median delay of the FIR with samples at t =
(0:19).
In the event, the problem is with FIR lengths > 512, I tried
freqz (postpad (ones (20, 1), 768), 1, 512, "half", 2);
... I don't see a problem here either. If I prepad instead there is a
problem, but only because the sampling in the frequency domain is
insufficient.
freqz (prepad (ones (20, 1), 768), 1, 512, "half", 2);
I am unable to compare with the commercial variant, but would expect a
similar behavior.
John/others am I missing something?
Ben
More information about the Bug-octave
mailing list