Forums

How to use Jake's Remez Exchange code to design a differenciator?

Started by chenjc March 3, 2007
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message

..............>
> There should be some doh! factoid to tell us why. I can't think of it > right now.
OK, I've thought about it..... In the even case there's a doublet in time with temporal spacing of T so that their effective quefrency is 2/T. So, there's a half wave over fs and a quarter wave over fs/2. In the odd case there's a doublet in time with temporal spacing of T so that they have a quefrency of 1/T. That's a half wave over fs/2. These longest waves stem from the largest coefficients that are approximately +1 and -1 in the filter/differentiator - so they are relatively high amplitude. Since the objective of the differentiator is to have gain 1/f, then having a large half wave component means that all of the other terms have to be used to "fight" the shape of this thing at one end (the end around fs/2). Whereas, having the largest component a quarter wave means that it's only a matter of "shaping" the response to be more linear. Having an even number of coefficients in a differentiator is thus important! It's one of those cases where changing the number of coefficients by 1 makes a big difference. I've seen other cases where this happens. The response gets better with N and then jumps up a bit and then gets better again as N increases further. Each jump up is smaller than the one before but the resulting response curve isn't linear. This usually happens when there's something in the desired function that's "nonlinear" so to speak - as in the case of forcing equalities while doing minimax otherwise. Fred
Fred Marshall wrote:

   ...

> About the only thing one might say is that a differentiator specification > should give an even length.
Odd length differentiators have much to recommend them for demodulating FM and stabilizing feedback loops. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Rune Allnor wrote:

   ...

> Of course, I haven't considered the phase to be important, which > probably is an obvious give-away for the fact that I haven't actually > designed a FIR diferentiator from scratch...
With antisymmetric components, the phase will necessarily be correct. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Fred Marshall wrote:

   ...

> For an odd length the result is terrible. It appears there's a sinusoidal > component in the magnitude response at the highest possible quefrency - > suggesting a doublet in the unit sample response at the ends. And, indeed, > that's what you get! In fact, the values for the unit sample response are > pretty terrible for length 33 while, for length 32, the unit sample response > looks like > [.......1 -1 .....] where the .... parts are rather small "adjustments" it > appears. > > I'd have to ponder further why this is. It suggests that getting the > desired response is indeed difficult for an odd length. > > There should be some doh! factoid to tell us why. I can't think of it right > now.
Symmetry makes the magnitude response of an odd-length differentiator peak at Fs/4. Since the curve is horizontal there, the part that's proportional to frequency doesn't extend that far. Lyons' 7-coefficient differentiator (three are zero and the others are integers or have power-of-two denominators) is as far as it seems worth pushing it. The moral of this story is that there's more than one reason to oversample. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Fred Marshall wrote:
> "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message > > ..............> >> There should be some doh! factoid to tell us why. I can't think of it >> right now. > > OK, I've thought about it..... > > In the even case there's a doublet in time with temporal spacing of T so > that their effective quefrency is 2/T. So, there's a half wave over fs and > a quarter wave over fs/2. > > In the odd case there's a doublet in time with temporal spacing of T so that > they have a quefrency of 1/T. That's a half wave over fs/2. > > These longest waves stem from the largest coefficients that are > approximately +1 and -1 in the filter/differentiator - so they are > relatively high amplitude. > > Since the objective of the differentiator is to have gain 1/f, then having a > large half wave component means that all of the other terms have to be used > to "fight" the shape of this thing at one end (the end around fs/2).
Wait a minute! Quadrature phase requires antisymmetry. Odd-length antisymmetry dictates a central zero, which is a problem unless one works at double the "expected" sample rate and designs a half-band structure. http://www.elecdesign.com/Articles/ArticleID/13358/13358.html Rick's coefficients are [-1/16 0 1 0 -1 0 1/16]. [1 0 -1] has 1/3 the delay, making it more suitable for most loops despite its poorer shape. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
"Jerry Avins" <jya@ieee.org> wrote in message 
news:VcidnYobOZG1NXbYnZ2dnUVZ_sKunZ2d@rcn.net...
> Fred Marshall wrote: >> "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message >> >> ..............> >>> There should be some doh! factoid to tell us why. I can't think of it >>> right now. >> >> OK, I've thought about it..... >> >> In the even case there's a doublet in time with temporal spacing of T so >> that their effective quefrency is 2/T. So, there's a half wave over fs >> and a quarter wave over fs/2. >> >> In the odd case there's a doublet in time with temporal spacing of T so >> that they have a quefrency of 1/T. That's a half wave over fs/2. >> >> These longest waves stem from the largest coefficients that are >> approximately +1 and -1 in the filter/differentiator - so they are >> relatively high amplitude. >> >> Since the objective of the differentiator is to have gain 1/f, then >> having a large half wave component means that all of the other terms have >> to be used to "fight" the shape of this thing at one end (the end around >> fs/2). > > Wait a minute! Quadrature phase requires antisymmetry. Odd-length > antisymmetry dictates a central zero, which is a problem unless one works > at double the "expected" sample rate and designs a half-band structure. > http://www.elecdesign.com/Articles/ArticleID/13358/13358.html Rick's > coefficients are [-1/16 0 1 0 -1 0 1/16]. [1 0 -1] has 1/3 the delay, > making it more suitable for most loops despite its poorer shape. > > Jerry
Jerry, You mean a central zero in frequency. Yes, you're correct. If the length is odd then the differentiator needs to be designed for a lesser bandwidth than fs/2 because the magnitude response *is* zero at fs/2. 80% of fs/2 bandwidth is OK though. Gold and Rabiner treat these cases in great detail. Fred
On 5 Mar, 08:21, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> > Fred Marshall wrote: > >> "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message > > >> ..............> > >>> There should be some doh! factoid to tell us why. I can't think of it > >>> right now. > > >> OK, I've thought about it.....
> You mean a central zero in frequency. Yes, you're correct. If the length > is odd then the differentiator needs to be designed for a lesser bandwidth > than fs/2 because the magnitude response *is* zero at fs/2. 80% of fs/2 > bandwidth is OK though.
Thanks for the elaborations, Fred. You know me, I'm too hung up on semantics. I have no problems accepting that practical matters might push things in this or that direction; if somebody say it *necessarily* has to be like this or like that, I need to understand why.
> Gold and Rabiner treat these cases in great detail.
That's the 1969 book (or was it 1973?), right? I have been looking for that book for ages. If somebody who reads this -- regular or lurker -- has contacts in the relevant pulishing house (I suspect it is Prentice Hall), could you PLEASE pull some strings and get them to reprint this thing? If you dig deep enough, you ALWAYS end up with "further details to be found in the book by Rabiner and Gold" somewhere. Very frustrating, if you can't find a copy of their book. Rune
Fred Marshall wrote:
> "Jerry Avins" <jya@ieee.org> wrote in message > news:VcidnYobOZG1NXbYnZ2dnUVZ_sKunZ2d@rcn.net... >> Fred Marshall wrote: >>> "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message >>> >>> ..............> >>>> There should be some doh! factoid to tell us why. I can't think of it >>>> right now. >>> OK, I've thought about it..... >>> >>> In the even case there's a doublet in time with temporal spacing of T so >>> that their effective quefrency is 2/T. So, there's a half wave over fs >>> and a quarter wave over fs/2. >>> >>> In the odd case there's a doublet in time with temporal spacing of T so >>> that they have a quefrency of 1/T. That's a half wave over fs/2. >>> >>> These longest waves stem from the largest coefficients that are >>> approximately +1 and -1 in the filter/differentiator - so they are >>> relatively high amplitude. >>> >>> Since the objective of the differentiator is to have gain 1/f, then >>> having a large half wave component means that all of the other terms have >>> to be used to "fight" the shape of this thing at one end (the end around >>> fs/2). >> Wait a minute! Quadrature phase requires antisymmetry. Odd-length >> antisymmetry dictates a central zero, which is a problem unless one works >> at double the "expected" sample rate and designs a half-band structure. >> http://www.elecdesign.com/Articles/ArticleID/13358/13358.html Rick's >> coefficients are [-1/16 0 1 0 -1 0 1/16]. [1 0 -1] has 1/3 the delay, >> making it more suitable for most loops despite its poorer shape. >> >> Jerry > > Jerry, > > You mean a central zero in frequency. Yes, you're correct. If the length > is odd then the differentiator needs to be designed for a lesser bandwidth > than fs/2 because the magnitude response *is* zero at fs/2. 80% of fs/2 > bandwidth is OK though. Gold and Rabiner treat these cases in great detail.
What application areas are well served by differentiators with large delays? FM demodulation might be one, but the sample rates there far exceed the bandwith needed by the differentiator. I can't think of a good use for a differentiator with a long delay, or how a non-integer delay could be an advantage. (And we all know that what I can't think of isn't important!) Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
"Rune Allnor" <allnor@tele.ntnu.no> wrote in message 
news:1173081805.468909.73240@j27g2000cwj.googlegroups.com...
> On 5 Mar, 08:21, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > >> Gold and Rabiner treat these cases in great detail. > > That's the 1969 book (or was it 1973?), right? I have been looking > for that book for ages. If somebody who reads this -- regular or > lurker -- has contacts in the relevant pulishing house (I suspect > it is Prentice Hall), could you PLEASE pull some strings and > get them to reprint this thing? > > If you dig deep enough, you ALWAYS end up with "further details > to be found in the book by Rabiner and Gold" somewhere. > Very frustrating, if you can't find a copy of their book. > > Rune
Rune, You can put in a standing request with Amazon I believe. Powell's Technical Books is another possible source and they have a good website (lucky me, it's fairly local and I can browse the shelves when I'm in Portland). They specialize in both new and used technical books. Want a copy of one of the MIT RadLab series anyone??? One source or another, that's how I got my copy of Rabiner and Gold after a time of waiting. Fred
"Jerry Avins" <jya@ieee.org> wrote in message 
news:08idnQ-ex98GrnHYnZ2dnUVZ_uiknZ2d@rcn.net...

> > What application areas are well served by differentiators with large > delays? FM demodulation might be one, but the sample rates there far > exceed the bandwith needed by the differentiator. I can't think of a good > use for a differentiator with a long delay, or how a non-integer delay > could be an advantage. (And we all know that what I can't think of isn't > important!) > > Jerry
Jerry, Darned if I know. As far as I'm concerned this is a thread about filter/differentiator *design*. There is *so* much beyond that to be considered in any system implementation. I'm sure you agree with that! I trust your instincts so it must be a good question! Perhaps someone else will be able to answer it. Fred