A little FIR/IIR puzzler
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
A little FIR/IIR puzzler
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP
Author Message
robert bristow-johnson
Guest





Posted: Sun Jan 09, 2005 7:57 am    Post subject: Re: A little FIR/IIR puzzler Reply with quote

in article zmzjqx9b.fsf@ieee.org, Randy Yates at yates@ieee.org wrote on
01/08/2005 19:09:

Quote:
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:

Randy Yates wrote:
(snip)

Thus here in your case N = 2 and thus

y[n] = y[n - 1] + (1/2) * (x[n] - x[n - 2])

If we take the z-transform and solve for the transfer function we get

Y(z)/X(z) = (1/2) * (z^2 - 1) / [z * (z - 1)].


Then factor out (z-1):

Y(z)/X(z) = (1/2) (z+1)/z

Then it's not recursive!

from the POV of "transfer function" it's pole-zero cancellation. whether
those (z-1) factors are in both numerator and denominator are irrelevant to
the transfer function (that linear mapping that sends X(z) to Y(z)).

now if you're doing the state-variable thing, that's a different story.
then it's in there and you'll find that it's either not completely
observable or not completely controllable.

--

r b-j rbj@audioimagination.com

"Imagination is more important than knowledge."
Back to top
Randy Yates
Guest





Posted: Mon Jan 10, 2005 4:57 am    Post subject: Re: A little FIR/IIR puzzler Reply with quote

robert bristow-johnson <rbj@audioimagination.com> writes:

Quote:
in article zmzjqx9b.fsf@ieee.org, Randy Yates at yates@ieee.org wrote on
01/08/2005 19:09:

glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:

Randy Yates wrote:
(snip)

Thus here in your case N = 2 and thus

y[n] = y[n - 1] + (1/2) * (x[n] - x[n - 2])

If we take the z-transform and solve for the transfer function we get

Y(z)/X(z) = (1/2) * (z^2 - 1) / [z * (z - 1)].


Then factor out (z-1):

Y(z)/X(z) = (1/2) (z+1)/z

Then it's not recursive!

from the POV of "transfer function" it's pole-zero cancellation. whether
those (z-1) factors are in both numerator and denominator are irrelevant to
the transfer function (that linear mapping that sends X(z) to Y(z)).

Roberts and Mullis I believe speak to this issue, i.e., that a transfer
function maps to many different implementations. It seems that in signal
processing we often mix the two worlds, e.g., we write the difference
equation according to a specific implementation, then take the z-transform
and form the input/output relationship. It is clear from this simple example
that simplifying such a relationship implicitly changes the implementation.

Or am I missing something?
--
% Randy Yates % "With time with what you've learned,
%% Fuquay-Varina, NC % they'll kiss the ground you walk
%%% 919-577-9882 % upon."
%%%% <yates@ieee.org> % '21st Century Man', *Time*, ELO
http://home.earthlink.net/~yatescr
Back to top
Randy Yates
Guest





Posted: Mon Jan 10, 2005 7:12 am    Post subject: Re: A little FIR/IIR puzzler Reply with quote

Randy Yates <yates@ieee.org> writes:

Quote:
robert bristow-johnson <rbj@audioimagination.com> writes:
[...]
from the POV of "transfer function" it's pole-zero cancellation. whether
those (z-1) factors are in both numerator and denominator are irrelevant to
the transfer function (that linear mapping that sends X(z) to Y(z)).

Allow me to back-pedal a bit: In the theory of complex variables, the
function f(z) = (z - 1) / (z - 1) (i.e., the *mapping* from D to A =
f(D), where D is the domain of the function) is not equivalent to the
function f(z) = 1. The first one has a singular point at z = 1, the
second one does not.

Thus I maintain that these two transfer functions are indeed different.
--
% Randy Yates % "...the answer lies within your soul
%% Fuquay-Varina, NC % 'cause no one knows which side
%%% 919-577-9882 % the coin will fall."
%%%% <yates@ieee.org> % 'Big Wheels', *Out of the Blue*, ELO
http://home.earthlink.net/~yatescr
Back to top
robert bristow-johnson
Guest





Posted: Mon Jan 10, 2005 7:59 am    Post subject: Re: A little FIR/IIR puzzler Reply with quote

in article oefyxc9u.fsf@ieee.org, Randy Yates at yates@ieee.org wrote on
01/09/2005 21:12:

Quote:
Randy Yates <yates@ieee.org> writes:

robert bristow-johnson <rbj@audioimagination.com> writes:
[...]
from the POV of "transfer function" it's pole-zero cancellation. whether
those (z-1) factors are in both numerator and denominator are irrelevant to
the transfer function (that linear mapping that sends X(z) to Y(z)).

Allow me to back-pedal a bit: In the theory of complex variables, the
function f(z) = (z - 1) / (z - 1) (i.e., the *mapping* from D to A =
f(D), where D is the domain of the function) is not equivalent to the
function f(z) = 1. The first one has a singular point at z = 1, the
second one does not.

it's called a "removable singularity" just like sin(z)/z has a removable
singularity at z=0 and is infinitely differentiable at z=0. (and in, fact,
has a McLauren series. very well behaved, even at z=0, for something with a
singularity.)

Quote:
Thus I maintain that these two transfer functions are indeed different.

Transfer functions are an input/output relationship of a black box.

H(z) = (z-1)/(z-1) ( where Y(z) = H(z)*X(z) )

this H(z) does nothing to the input X(z), in computing Y(z), that H(z) = 1
does not do.

however, if you're into control theory and you worry about internal states
exploding or not, then there is a difference. a zero might cancel a pole
from a black box perspective but it doesn't prevent some internal state from
exploding, but just masks or "cancels" some internal exponential growth of
something.

--

r b-j rbj@audioimagination.com

"Imagination is more important than knowledge."
Back to top
Rick Lyons
Guest





Posted: Mon Jan 10, 2005 8:41 pm    Post subject: Re: A little FIR/IIR puzzler Reply with quote

On Sat, 08 Jan 2005 13:07:38 -0500, robert bristow-johnson
<rbj@audioimagination.com> wrote:

(snipped)
Quote:

which is similar to that of running the FILTFILT utility. you design an IIR
filter to exactly 1/2 the dB specification that you ultimately want because
you're gonna run the signal through the filter twice once forward and
another time in reverse, or in the case of Wang/Smith, once through a stable
TIIR and another through an unstable (mirrored poles/zeros) TIIR (and then
worry about the consequences of that unstability by ping-ponging two
identical unstable TIIRs and overlap adding the result. i like the time
reversing idea of Powell & Chau or Azizi better. it just seems safer.

Hi Robert,

It's clear to me that you understand Wang/Smith much better
than I do. Darn, I wish they'd given a small simple example
with a block diagram, pole/zero plots, impulse responses,
freq responses, etc. I think you're right about TIIR filters
and FSFs being similar but certainly not identical.

Quote:

your FSF filters are never really unstable, just "critically stable" and
then you nudge them into the unit circle a teeny bit.

Yep.

Quote:
but i am taken by the similarity of concept and am reading your chapter 7
now. it's amazing how many ways there are to skin the cat.

FSFs have been around for roughly forty years!

FSFs are recursive FIR linear-phase filters.
I cover them, in some detail, in Section 7.1 of
the 2nd Edition of my book. As it turns out, for
some applications, FSFs are more computationally
efficient than Parks-McClellan-designed FIR filters.

but their frequency response is not as "tightly designed" as with P-McC, is
it Rick? the FSF seems to hit the target right on the sampling frequencies
of 2*pi*k/N, and in between it interpolates nicely, but might not do what
you want it to.

Yep, you're right. One problem with FSFs is that
we have no meaningful control over their
stopband attenuation (as we do with
Parks--McClellan-designed FIRs). With FSFs,
you achieve whatever stopband attenuation
they provide, and then you have to
decide if that attenuation meets your
requirements or not.

Ah! SOOooo much to learn and so little time.

See Ya,
[-Rick-]
Back to top
Jon Harris
Guest





Posted: Tue Jan 11, 2005 12:29 am    Post subject: Re: A little FIR/IIR puzzler Reply with quote

"Randy Yates" <yates@ieee.org> wrote in message news:k6qo8v14.fsf@ieee.org...
Quote:
"Jon Harris" <goldentully@hotmail.com> writes:

Just playing around, I created arguably the simplest possible digital
filter--it
simply averages the current sample and the previous sample to produce each
output sample. You might call this a moving average filter with averaging
length = 2. I plotted the impulse and frequency responses with Matlab, and
all
looked as expected. Now I know from past experience that this filter is an
FIR
filter.

While examining the frequency response, I noticed that it has infinite
attenuation at Fs/2 (Nyquist) and ~3dB attenuation Fs/4, which makes sense
intuitively.

I also have at my disposal some equations and Matlab code to create
arbitrary
IIR filters (biquads or first order). So I decided to create a first-order
IIR
filter with a cut-off at exactly Fs/2 using my equations and compare it to
the
simple FIR. When I compared the two filters' responses, I noticed that they
were identical! My IIR routine had generated exactly the same filter as the
simple FIR I constructed (to within the numerical accuracy of Matlab). So
how
is it that my IIR filter routine can generate an FIR filter?

I'll take a stab, Jon.


The boxcar moving average filter is given by.

y[n] = (1/N) * sum_{j=0}^{N-1} x[n-j].

However, there is a recursive way to compute the filter as well:

y[n] = y[n-1] + (1/N) * (x[n] - x[n-N]).

This can be easily derived by reexpressing the non-recursive form as

y[n-1] = (1/N) * (x[n - 1] + x[n - 2] + ... + x[n - N])

and

y[n] = (1/N) * (x[n - 0] + x[n - 1] + x[n - 2] + ... + x[n-N+1])

Then

y[n] - y[n - 1] = (1/N) * (x[n - 0] - x[n - N])

and we solve for y[n]:

y[n] = y[n - 1] + (1/N) * (x[n - 0] - x[n - N])

Thus here in your case N = 2 and thus

y[n] = y[n - 1] + (1/2) * (x[n] - x[n - 2])

If we take the z-transform and solve for the transfer function we get

Y(z)/X(z) = (1/2) * (z^2 - 1) / [z * (z - 1)].

Is this the IIR your matlab routine came up with?

No, it came up with the one mentioned by Glen: Y(z)/X(z) = (1/2) (z+1)/z. I
guess the routine doesn't know that it is supposed to be a recursive filter and
generates the simplest response. :-)
Back to top
Jon Harris
Guest





Posted: Tue Jan 11, 2005 12:33 am    Post subject: Re: A little FIR/IIR puzzler Reply with quote

"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:10tu8p0qm2oi096@corp.supernews.com...
Quote:
Jon Harris wrote:

Just playing around, I created arguably the simplest possible digital
filter--it
simply averages the current sample and the previous sample to produce each
output sample. You might call this a moving average filter with averaging
length = 2. I plotted the impulse and frequency responses with Matlab, and
all
looked as expected. Now I know from past experience that this filter is an
FIR
filter.

While examining the frequency response, I noticed that it has infinite
attenuation at Fs/2 (Nyquist) and ~3dB attenuation Fs/4, which makes sense
intuitively.

I also have at my disposal some equations and Matlab code to create
arbitrary
IIR filters (biquads or first order). So I decided to create a first-order
IIR
filter with a cut-off at exactly Fs/2 using my equations and compare it to
the
simple FIR. When I compared the two filters' responses, I noticed that they
were identical! My IIR routine had generated exactly the same filter as the
simple FIR I constructed (to within the numerical accuracy of Matlab). So
how
is it that my IIR filter routine can generate an FIR filter?


Did you look at the IIR filter that Matlab coughed up?

Yes. The filter coefs were identical to the FIR boxcar version to within the
numerical accuracy of Matlab.
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB