DSPRelated.com
Forums

Differentiators using Remez/Parks McClellan

Started by Kumar Appaiah March 1, 2007
From the original code

>C >C THE FOLLOWING INPUT DATA SPECIFIES A LENGTH 32 FULLBAND >C DIFFERENTIATOR WITH SLOPE 1 AND WEIGHTING OF 1/F. >C THE GRID DENSITY WILL BE SET TO 20. >C 32,2,1,20 >C 0,0.5 >C 1.0 >C 1.0
In article <1172909907.361586.33120@h3g2000cwc.googlegroups.com>, "Kumar Appaiah" <kumar.appaiah@gmail.com> wrote:
>On Mar 2, 12:53 pm, Rune Allnor wrote: >> There are some examples on specifications for differentiators >> in the book by Proakis and Manolakis. Check the parameters >> they give. > >Dear Rune, > >Thanks for the advice. But right now, I can't get my hands on that >book. Of course, I am still having major problems with that remez code >as well as in GNU Octave (which uses a version of that code for its >remez). So, I'd still appreciate it if someone looks at that remez >function and tells me how to get a differentiator, as I have been >unsuccessful in all attempts to get a differentiator from that. > >Thanks. > >Kumar >
Vladimir Vassilevsky wrote:
> > > Jerry Avins wrote: > >> You want a Hilbert transformer at DC? How long can you wait for output? >> Hint: the output of a HT is the input shifted by 90 degrees. What is >> the duration of 90 degrees at 100 Hz? 1 Hz? .01 Hz? > > Jerry, you mistake the phase shift for the group delay. > > It is possible to generate any phase shift using any small amount of > delay at any given frequency. However, the group delay is a different > story.
Why do you so often find a nit to pick? A Hilbert transformer's delay is constant with frequency but provides 90 degrees at all frequencies. Because of that constant group delay, the delay at any frequency can be no less than a quarter cycle at the lowest. I asked Kumar (indirectly, with snideness that we share) the duration of a quarter cycle of DC. 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;
Kumar Appaiah wrote:
> On Mar 3, 11:45 pm, Vladimir Vassilevsky wrote: >> Jerry Avins wrote: >>> You want a Hilbert transformer at DC? How long can you wait for output? >>> Hint: the output of a HT is the input shifted by 90 degrees. What is the >>> duration of 90 degrees at 100 Hz? 1 Hz? .01 Hz? >> Jerry, you mistake the phase shift for the group delay. >> >> It is possible to generate any phase shift using any small amount of >> delay at any given frequency. However, the group delay is a different story. >> >> Vladimir Vassilevsky > > Right, let me get this clear. All I want now is a filter whose > magnitude response will resemble a Hilbert transformer closely, of > course, except near DC and z = -1 (high frequency). I just want to see > a Hilbert differentiator and differentiator working with Jake's code, > which also happens to be used in various other software, including GNU > Octave. It isn't for any practical implementation (at least now).
Delay aside, the magnitude response of a Hilbert Transformer is the same as that of a wire. The interesting aspect of a Hilbert Transformer is its phase response. 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;
On 3 Mar, 21:12, Jerry Avins <j...@ieee.org> wrote:
> I asked Kumar (indirectly, > with snideness that we share) the duration of a quarter cycle of DC.
The question is irrelevant. Since the OP asked for a differentiator, the frequency resonse of the desired filter is proportional to frequency, w. So I'll turn the question right back at you: Why are the technicalities of what happens at DC at all relevant? Rune
Rune Allnor wrote:
> On 3 Mar, 21:12, Jerry Avins <j...@ieee.org> wrote: >> I asked Kumar (indirectly, >> with snideness that we share) the duration of a quarter cycle of DC. > > The question is irrelevant. Since the OP asked for a differentiator, > the frequency resonse of the desired filter is proportional to > frequency, w. > > So I'll turn the question right back at you: Why are the > technicalities > of what happens at DC at all relevant?
Kumar asked for a differentiator and HT. I misread his clause "except near DC" and took it to include DC, so I got derailed. I still have a problem with "the magnitude response of a Hilbert transformer". That's a NOP. 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;
On 3 Mar, 21:36, Jerry Avins <j...@ieee.org> wrote:
> Rune Allnor wrote: > > On 3 Mar, 21:12, Jerry Avins <j...@ieee.org> wrote: > >> I asked Kumar (indirectly, > >> with snideness that we share) the duration of a quarter cycle of DC. > > > The question is irrelevant. Since the OP asked for a differentiator, > > the frequency resonse of the desired filter is proportional to > > frequency, w. > > > So I'll turn the question right back at you: Why are the > > technicalities > > of what happens at DC at all relevant? > > Kumar asked for a differentiator and HT.
OK, I didn't catch hat first tie around.
> I misread his clause "except > near DC" and took it to include DC, so I got derailed. I still have a > problem with "the magnitude response of a Hilbert transformer".
Why? I can't remember reading in any of your posts, or anybody else's, for that matter, that there are any problems with FIR filters, be it filters designed by wind methods or by the Remez method. As you know, the "usual" FIR filters are approximations to the ideal filter. No big deal, right, Gibbs phenomena and all? The HT is the same thing: The ideal is unit magnitudes with +/- 90 degree phase lags for negative and positive frequencies, except for discontinuities at w = 0 and w = Fs/2. I can't see why those should be any big deals; they are discontiuities just like the cut-off frequencies in the "usual" FIR filters, albeit at conspicuous locations. Rune
Rune Allnor wrote:
> On 3 Mar, 21:36, Jerry Avins <j...@ieee.org> wrote:
...
>> I still have a >> problem with "the magnitude response of a Hilbert transformer". > > Why? I can't remember reading in any of your posts, or anybody > else's, for that matter, that there are any problems with FIR > filters, > be it filters designed by wind methods or by the Remez method.
The magnitude response of an ideal Hilbert transformer is the same as the magnitude response of a wire, ignoring delay. Kumar writes that he's content to ignore phase. So what does he want? A pure delay? How long? That's what I have trouble with.
> As you know, the "usual" FIR filters are approximations to the > ideal filter. No big deal, right, Gibbs phenomena and all? > > The HT is the same thing: The ideal is unit magnitudes with > +/- 90 degree phase lags for negative and positive frequencies, > except for discontinuities at w = 0 and w = Fs/2. I can't see why > those should be any big deals; they are discontiuities just like the > cut-off frequencies in the "usual" FIR filters, albeit at conspicuous > locations.
FIR impulse responses get very long when significant frequencies are very small fractions of (or come very close to) Fs/2, whatever they're intended for. HTs are no different. 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;
On Mar 4, 1:06 am, John_W_Her...@yahoo.com (John Herman) wrote:
> From the original code > > >C > >C THE FOLLOWING INPUT DATA SPECIFIES A LENGTH 32 FULLBAND > >C DIFFERENTIATOR WITH SLOPE 1 AND WEIGHTING OF 1/F. > >C THE GRID DENSITY WILL BE SET TO 20. > >C 32,2,1,20 > >C 0,0.5 > >C 1.0 > >C 1.0
Ah, but that's from Parks and McClellan's original Fortran code. I was, in particular, interested in Jake Janovetz's code, with which I am having problems.. Thanks for the suggestion anyway. I notice that the only case where I get a linear slope differentiator is if I have the filter length N = 2. Whenever I make N even 4, it goes up, falls to zero, and then goes up again at pi. Kumar
On Mar 4, 2:11 am, wrote:
> The magnitude response of an ideal Hilbert transformer is the same as > the magnitude response of a wire, ignoring delay. Kumar writes that he's > content to ignore phase. So what does he want? A pure delay? How long? > That's what I have trouble with.
You are correct, and I realize that I should have worded my question a bit more carefully. I apologize for my carelessness. OK, but still, my question remains this: whether someone has managed to design a Hilbert transformer and/or a differentiator successfully with Jake's code or GNU Octave? I have tried to debug it, but I can't seem to find where the mistake lies, or what I'm doing wrong.
> FIR impulse responses get very long when significant frequencies are > very small fractions of (or come very close to) Fs/2, whatever they're > intended for. HTs are no different.
I really don't care about the length now. As long as I get something close to +90 and -90 degrees of phase shift in most parts of the -pi to pi interval with gain close to 1 (magnitude), I am happy. All I want to know is "the right way" to use Jake's code for this purpose, as it doesn't seem to be doing the same thing Matlab is doing. Thanks. Kumar
Kumar Appaiah wrote:
> On Mar 4, 1:06 am, John_W_Her...@yahoo.com (John Herman) wrote: >> From the original code >> >>> C >>> C THE FOLLOWING INPUT DATA SPECIFIES A LENGTH 32 FULLBAND >>> C DIFFERENTIATOR WITH SLOPE 1 AND WEIGHTING OF 1/F. >>> C THE GRID DENSITY WILL BE SET TO 20. >>> C 32,2,1,20 >>> C 0,0.5 >>> C 1.0 >>> C 1.0 > > Ah, but that's from Parks and McClellan's original Fortran code. I > was, in particular, interested in Jake Janovetz's code, with which I > am having problems.. > > Thanks for the suggestion anyway. I notice that the only case where I > get a linear slope differentiator is if I have the filter length N = > 2. Whenever I make N even 4, it goes up, falls to zero, and then goes > up again at pi.
Let me give you some unsolicited information about digital differentiators. For most purposes, they don't work worth a dam at frequencies above Fs/6. For most purposes, the derivative is wanted at a time that corresponds to a sample of the undifferentiated signal, as in the expression IQ' + QI' or in a feedback loop. That makes differentiators with integer delay most convenient, which in turn implies an odd number of taps, which in turn implies a zero of response at Fs/2. Some differentiators are used to stabilize closed loops. Long FIRS that approximate a differentiator well have long delays and are wholly unsuitable for stabilizing feedback loops. Most practitioners seem to feel that [-1 0 +1] is the best compromise, even though control systems should be sampled much above 2Fmax. Real signals are noisy, and differentiators emphasize high-frequency noise. Even most analog "differentiators" are rolled off at high frequencies. Digital differentiators with an odd number of taps roll off properly. If you have time to waste, you can use a 5-tap differentiator, but more than that brings only diminishing returns as you try to reach Fs/4. Rick Lyons published an easily computed 5-tap differentiator. Ask him or Google for it. If you explain what you want the differentiator to do, we might be able to help you. 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;