Dear comp.dsp, I have written a simple Parks McClellan implementation myself, and wish to extend it for differentiators. Later, I came across Jake Janovetz's code here http://www.janovetz.com/jake/ and tried it out to find out how to get differentiators. I am able to get ordinary high/ low/band pass filters with ease, but I am struggling to get a differentiator as I don't know the bands it expects. For example: desired[0] = 0; desired[1] = 100; weights[0] = 1; weights[1] = 1; bands[0] = 0; bands[1] = 0.01; bands[2] = 0.49; bands[3] = 0.5; #define N 21 remez(h, N, 2, bands, desired, weights, 2); does a lousy job. How do I fix the bands for a differentiator? I ask this because it is different from the Octave/Matlab remez. Thanks. Kumar
Differentiators using Remez/Parks McClellan
Started by ●March 1, 2007
Reply by ●March 2, 20072007-03-02
On 2 Mar, 03:05, "Kumar Appaiah" <kumar.appa...@gmail.com> wrote:> Dear comp.dsp, > > I have written a simple Parks McClellan implementation myself, and > wish to extend it for differentiators. Later, I came across Jake > Janovetz's code herehttp://www.janovetz.com/jake/and tried it out to > find out how to get differentiators. I am able to get ordinary high/ > low/band pass filters with ease, but I am struggling to get a > differentiator as I don't know the bands it expects.There are some examples on specifications for differentiators in the book by Proakis and Manolakis. Check the parameters they give. Rune
Reply by ●March 3, 20072007-03-03
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
Reply by ●March 3, 20072007-03-03
On Mar 1, 9:05 pm, "Kumar Appaiah" <kumar.appa...@gmail.com> wrote:> Dear comp.dsp, > > I have written a simple Parks McClellan implementation myself, and > wish to extend it for differentiators. Later, I came across Jake > Janovetz's code herehttp://www.janovetz.com/jake/and tried it out to > find out how to get differentiators. I am able to get ordinary high/ > low/band pass filters with ease, but I am struggling to get a > differentiator as I don't know the bands it expects. For example: > > desired[0] = 0; > desired[1] = 100; > > weights[0] = 1; > weights[1] = 1; > > bands[0] = 0; > bands[1] = 0.01; > bands[2] = 0.49; > bands[3] = 0.5; > > #define N 21 > remez(h, N, 2, bands, desired, weights, 2); > > does a lousy job. How do I fix the bands for a differentiator? I ask > this because it is different from the Octave/Matlab remez. > > Thanks. > > KumarHello Kumar, A problem I see is differentiators with odd length require a zero at half of the sampling rate. So either bring in the upper end of the band away from half of the sampling rate or use and even length. Clay
Reply by ●March 3, 20072007-03-03
On Mar 3, 6:36 pm, "Clay" wrote:> Hello Kumar, > > A problem I see is differentiators with odd length require a zero at > half of the sampling rate. So either bring in the upper end of the > band away from half of the sampling rate or use and even length.Dear Clay, You are right with respect to the fact that differentiators are type-4 for best results. So, here's the code: desired[0] = 0; desired[1] = 1; weights[0] = 1; weights[1] = 1; bands[0] = 0; bands[1] = 0.07; bands[2] = 0.4; bands[3] = 0.5; #define N 30 remez(h, N, 2, bands, desired, weights, 2); for (i=0; i<N; i++) { printf("%23.20f\n", h[i]); } Now, notice that bands[1] is 0.07, which means that the response is zero till 0.07 * 2pi. Now, if I try reducing that 0.07 to *anything* lower, it fails to converge. Which means I get something like a band- pass differentiator, as opposed to something which should begin at 0 and grow linearly. Any further tips? Thanks a lot! Kumar
Reply by ●March 3, 20072007-03-03
On Mar 3, 10:33 pm, "Kumar Appaiah" <kumar.appa...@gmail.com> wrote:> Now, notice that bands[1] is 0.07, which means that the response is > zero till 0.07 * 2pi. Now, if I try reducing that 0.07 to *anything* > lower, it fails to converge. Which means I get something like a band- > pass differentiator, as opposed to something which should begin at 0 > and grow linearly. > > Any further tips?Which also brings me to the next point of the struggle. I am unable to get Hilbert transformers as well! I do not believe that this code, which is used in various remez implementations, would not have this feature working. So, could someone who has used it please chip in with the right way to use this function for designing a differentiator and hilbert transformer? Thanks. Kumar
Reply by ●March 3, 20072007-03-03
Kumar Appaiah wrote:> On Mar 3, 10:33 pm, "Kumar Appaiah" <kumar.appa...@gmail.com> wrote: >> Now, notice that bands[1] is 0.07, which means that the response is >> zero till 0.07 * 2pi. Now, if I try reducing that 0.07 to *anything* >> lower, it fails to converge. Which means I get something like a band- >> pass differentiator, as opposed to something which should begin at 0 >> and grow linearly. >> >> Any further tips? > > Which also brings me to the next point of the struggle. I am unable to > get Hilbert transformers as well! I do not believe that this code, > which is used in various remez implementations, would not have this > feature working. So, could someone who has used it please chip in with > the right way to use this function for designing a differentiator and > hilbert transformer?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 -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●March 3, 20072007-03-03
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 DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●March 3, 20072007-03-03
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 VassilevskyRight, 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). Thanks. Kumar
Reply by ●March 3, 20072007-03-03