# remezord & weight vector

Started by January 7, 2003
 Hello, When using remezord to estimate the length of a filter given the desired specifications the remezord function also returns a weight vector w to be passed to the remez function to design the actual filter. My understanding was that these weights tell the remez function the relative errors we would like in each of the filter's frequency bands. As such, these weights should NOT be affected by the actual magnitude of the bands under consideration. For example, suppose I want to design the following 2 filters: filter1 passband [0,0.4] magnitude 1.00 allowed ripple: 0.01 stopband [0.5,1] magnitude 0 allowed ripple: 0.01 filter2 passband [0,0.4] magnitude 0.5 allowed ripple: 0.01 stopband [0.5,1] magnitude 0 allowed ripple: 0.01 If I feed this information to remezord then for the first filter the returned weight vector will be w = [1 1]. For the 2nd filter it would return w = [1 2]. So even though the allowed ripple is the same for both filters the weight vector remezord returns DOES depend on the band under consideration. So this means remez does not correspond exactly to the Parks-McClellan design as described in DSP textbooks? What's the reason the remez function uses these scheme for the weight vectors? thanks
 Moshe- Parks-McClellan method is an equiripple approach. If you increase magnitude (rejection dB) but hold passband ripple constant, then the resulting filter is "more difficult" given the same number of taps, and greater emphasis has to be placed on the stopband to maintain equiripple. Jeff Brower DSP sw/hw engineer Signalogic Moshe Malkin wrote: > > Hello, > > When using remezord to estimate the length of a filter given the > desired specifications the remezord function also returns a weight > vector w to be passed to the remez function to design the actual > filter. > > My understanding was that these weights tell the remez function the > relative errors we would like in each of the filter's frequency bands. > > As such, these weights should NOT be affected by the actual magnitude > of the bands under consideration. > For example, suppose I want to design the following 2 filters: > > filter1 > passband [0,0.4] magnitude 1.00 allowed ripple: 0.01 > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > filter2 > passband [0,0.4] magnitude 0.5 allowed ripple: 0.01 > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > If I feed this information to remezord then for the first filter the > returned > weight vector will be w = [1 1]. > > For the 2nd filter it would return w = [1 2]. > > So even though the allowed ripple is the same for both filters the > weight vector remezord returns DOES depend on the band under > consideration. > > So this means remez does not correspond exactly to the Parks-McClellan > design as described in DSP textbooks? > What's the reason the remez function uses these scheme for the weight > vectors?
 Moshe- > want the > optimum equiripple filter to have the ripple in the stopband three times > less than the ripple in the passband. I'm not sure, but that may be the slight flaw in your thinking. The ripple will be the *same* in the passband as in all stopbands, by definition of P-M method, regardless of what you do with weights. Therefore the weight algorithm has to compare the magnitude difference between each stopband area, so that's what it's looking at, not ripple. It's been a long time since I worked closely with PM stuff. A long time ago I integrated it into a software package called Hypersignal-Workstation, which went on to become other Hypersignal software. I remember that getting the weights to work transparently to the user; i.e. so the user had only to specify ripple and stopband magnitudes, was tricky and took quite a long time. -Jeff Moshe Malkin wrote: > > Hello, > > Thanks for the response. I agree with your analysis. > However, what I am talking about is convention used with weight vectors. > The ONLY thing the weight vector indicates is the ratio of the maximum > error in the passband to the maximum error in the stopband. > > For example, if for a LPF design we give the remez functions the > following params: > > n = 50; > f = [0 0.3 0.5 1]; > a = [1 1 0 0]; > w = [1 3]; > > And > > b = remez(n,f,a,w); > > then the weight vector SHOULD indicate that we weigh the error in the > stop band three times as much as the error in the passband. Hence, we > want the > optimum equiripple filter to have the ripple in the stopband three times > less than the ripple in the passband. > > So, you see, as I understand it the weigh vector should not be concerned > about the magnitude of the bands at all, but only ratios of the errors > in all the bands. > > Maybe I am wrong about this but it seems that this is the way the weight > "function" is explained in standard textbooks, like the Proakis & > Manolakis book. > > Thanks, > > Moshe > -----Original Message----- > From: Jeff Brower [mailto:] > Sent: Tuesday, January 07, 2003 1:42 PM > To: Moshe Malkin > Cc: > Subject: Re: [matlab] remezord & weight vector > > Moshe- > > Parks-McClellan method is an equiripple approach. If you increase > magnitude > (rejection dB) but hold passband ripple constant, then the resulting > filter is "more > difficult" given the same number of taps, and greater emphasis has to be > placed on > the stopband to maintain equiripple. > > Jeff Brower > DSP sw/hw engineer > Signalogic > > Moshe Malkin wrote: > > > > Hello, > > > > When using remezord to estimate the length of a filter given the > > desired specifications the remezord function also returns a weight > > vector w to be passed to the remez function to design the actual > > filter. > > > > My understanding was that these weights tell the remez function the > > relative errors we would like in each of the filter's frequency bands. > > > > As such, these weights should NOT be affected by the actual magnitude > > of the bands under consideration. > > For example, suppose I want to design the following 2 filters: > > > > filter1 > > passband [0,0.4] magnitude 1.00 allowed ripple: 0.01 > > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > > > > > > filter2 > > passband [0,0.4] magnitude 0.5 allowed ripple: 0.01 > > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > > > > > > If I feed this information to remezord then for the first filter the > > returned > > weight vector will be w = [1 1]. > > > > For the 2nd filter it would return w = [1 2]. > > > > > > > > So even though the allowed ripple is the same for both filters the > > weight vector remezord returns DOES depend on the band under > > consideration. > > > > So this means remez does not correspond exactly to the Parks-McClellan > > design as described in DSP textbooks? > > What's the reason the remez function uses these scheme for the weight > > vectors?
 Hello, As to your comment about the definition of equiripple, I think the exact definition is a little different than what you have stated below. If you recall, the WEIGHTED APPROXIMATION ERROR is defined as E(w) = W(w)[H_d(w) - H_r(w)] W(w) = weighting function (weigh vector in matlab) H_d(w) = desired magnitude response H_r(w) = the actual magnitude response. What the theory says is that this WEIGHTED APPROXIMATION ERROR E(w) possesses an equiripple nature (same ripple in stopband and passband). However, this equiripple behavior is present ONLY AFTER we have weighted the difference [H_d(w) - H_r(w)] by the weighting function W(w). However, the ACTUAL error RIPPLE in the response [H_d(w) - H_r(w)] does not necessarily posses an equiripple characteristic. Am I being clear? Moshe -----Original Message----- From: Jeff Brower [mailto:] Sent: Friday, January 10, 2003 6:40 AM To: Moshe Malkin Cc: Subject: Re: [matlab] remezord & weight vector Moshe- > want the > optimum equiripple filter to have the ripple in the stopband three times > less than the ripple in the passband. I'm not sure, but that may be the slight flaw in your thinking. The ripple will be the *same* in the passband as in all stopbands, by definition of P-M method, regardless of what you do with weights. Therefore the weight algorithm has to compare the magnitude difference between each stopband area, so that's what it's looking at, not ripple. It's been a long time since I worked closely with PM stuff. A long time ago I integrated it into a software package called Hypersignal-Workstation, which went on to become other Hypersignal software. I remember that getting the weights to work transparently to the user; i.e. so the user had only to specify ripple and stopband magnitudes, was tricky and took quite a long time. -Jeff Moshe Malkin wrote: > > Hello, > > Thanks for the response. I agree with your analysis. > However, what I am talking about is convention used with weight vectors. > The ONLY thing the weight vector indicates is the ratio of the maximum > error in the passband to the maximum error in the stopband. > > For example, if for a LPF design we give the remez functions the > following params: > > n = 50; > f = [0 0.3 0.5 1]; > a = [1 1 0 0]; > w = [1 3]; > > And > > b = remez(n,f,a,w); > > then the weight vector SHOULD indicate that we weigh the error in the > stop band three times as much as the error in the passband. Hence, we > want the > optimum equiripple filter to have the ripple in the stopband three times > less than the ripple in the passband. > > So, you see, as I understand it the weigh vector should not be concerned > about the magnitude of the bands at all, but only ratios of the errors > in all the bands. > > Maybe I am wrong about this but it seems that this is the way the weight > "function" is explained in standard textbooks, like the Proakis & > Manolakis book. > > Thanks, > > Moshe > -----Original Message----- > From: Jeff Brower [mailto:] > Sent: Tuesday, January 07, 2003 1:42 PM > To: Moshe Malkin > Cc: > Subject: Re: [matlab] remezord & weight vector > > Moshe- > > Parks-McClellan method is an equiripple approach. If you increase > magnitude > (rejection dB) but hold passband ripple constant, then the resulting > filter is "more > difficult" given the same number of taps, and greater emphasis has to be > placed on > the stopband to maintain equiripple. > > Jeff Brower > DSP sw/hw engineer > Signalogic > > Moshe Malkin wrote: > > > > Hello, > > > > When using remezord to estimate the length of a filter given the > > desired specifications the remezord function also returns a weight > > vector w to be passed to the remez function to design the actual > > filter. > > > > My understanding was that these weights tell the remez function the > > relative errors we would like in each of the filter's frequency bands. > > > > As such, these weights should NOT be affected by the actual magnitude > > of the bands under consideration. > > For example, suppose I want to design the following 2 filters: > > > > filter1 > > passband [0,0.4] magnitude 1.00 allowed ripple: 0.01 > > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > > > > > > filter2 > > passband [0,0.4] magnitude 0.5 allowed ripple: 0.01 > > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > > > > > > If I feed this information to remezord then for the first filter the > > returned > > weight vector will be w = [1 1]. > > > > For the 2nd filter it would return w = [1 2]. > > > > > > > > So even though the allowed ripple is the same for both filters the > > weight vector remezord returns DOES depend on the band under > > consideration. > > > > So this means remez does not correspond exactly to the Parks-McClellan > > design as described in DSP textbooks? > > What's the reason the remez function uses these scheme for the weight > > vectors?
 Moshe- > However, this equiripple behavior is present ONLY AFTER we have weighted > the difference [H_d(w) - H_r(w)] by the weighting function W(w). W(w) can be anything (that does not prevent convergence), and H_r(w) is always equiripple, which refers to the nature of the magnitude response. Jeff Brower DSP sw/hw engineer Signalogic Moshe Malkin wrote: > > Hello, > > As to your comment about the definition of equiripple, I think the exact > definition is a little different than what you have stated below. > > If you recall, the WEIGHTED APPROXIMATION ERROR is defined as > > E(w) = W(w)[H_d(w) - H_r(w)] > > W(w) = weighting function (weigh vector in matlab) > H_d(w) = desired magnitude response > H_r(w) = the actual magnitude response. > > What the theory says is that this WEIGHTED APPROXIMATION ERROR E(w) > possesses an equiripple nature (same ripple in stopband and passband). > However, this equiripple behavior is present ONLY AFTER we have weighted > the difference [H_d(w) - H_r(w)] by the weighting function W(w). > > However, the ACTUAL error RIPPLE in the response [H_d(w) - H_r(w)] does > not necessarily posses an equiripple characteristic. > > Am I being clear? > > Moshe > -----Original Message----- > From: Jeff Brower [mailto:] > Sent: Friday, January 10, 2003 6:40 AM > To: Moshe Malkin > Cc: > Subject: Re: [matlab] remezord & weight vector > > Moshe- > > > want the > > optimum equiripple filter to have the ripple in the stopband three > times > > less than the ripple in the passband. > > I'm not sure, but that may be the slight flaw in your thinking. The > ripple will be > the *same* in the passband as in all stopbands, by definition of P-M > method, > regardless of what you do with weights. Therefore the weight algorithm > has to > compare the magnitude difference between each stopband area, so that's > what it's > looking at, not ripple. > > It's been a long time since I worked closely with PM stuff. A long time > ago I > integrated it into a software package called Hypersignal-Workstation, > which went on > to become other Hypersignal software. I remember that getting the > weights to work > transparently to the user; i.e. so the user had only to specify ripple > and stopband > magnitudes, was tricky and took quite a long time. > > -Jeff > > Moshe Malkin wrote: > > > > Hello, > > > > Thanks for the response. I agree with your analysis. > > However, what I am talking about is convention used with weight > vectors. > > The ONLY thing the weight vector indicates is the ratio of the maximum > > error in the passband to the maximum error in the stopband. > > > > For example, if for a LPF design we give the remez functions the > > following params: > > > > n = 50; > > f = [0 0.3 0.5 1]; > > a = [1 1 0 0]; > > w = [1 3]; > > > > And > > > > b = remez(n,f,a,w); > > > > then the weight vector SHOULD indicate that we weigh the error in the > > stop band three times as much as the error in the passband. Hence, we > > want the > > optimum equiripple filter to have the ripple in the stopband three > times > > less than the ripple in the passband. > > > > So, you see, as I understand it the weigh vector should not be > concerned > > about the magnitude of the bands at all, but only ratios of the errors > > in all the bands. > > > > Maybe I am wrong about this but it seems that this is the way the > weight > > "function" is explained in standard textbooks, like the Proakis & > > Manolakis book. > > > > Thanks, > > > > Moshe > > > > > > -----Original Message----- > > From: Jeff Brower [mailto:] > > Sent: Tuesday, January 07, 2003 1:42 PM > > To: Moshe Malkin > > Cc: > > Subject: Re: [matlab] remezord & weight vector > > > > Moshe- > > > > Parks-McClellan method is an equiripple approach. If you increase > > magnitude > > (rejection dB) but hold passband ripple constant, then the resulting > > filter is "more > > difficult" given the same number of taps, and greater emphasis has to > be > > placed on > > the stopband to maintain equiripple. > > > > Jeff Brower > > DSP sw/hw engineer > > Signalogic > > > > Moshe Malkin wrote: > > > > > > Hello, > > > > > > When using remezord to estimate the length of a filter given the > > > desired specifications the remezord function also returns a weight > > > vector w to be passed to the remez function to design the actual > > > filter. > > > > > > My understanding was that these weights tell the remez function the > > > relative errors we would like in each of the filter's frequency > bands. > > > > > > As such, these weights should NOT be affected by the actual > magnitude > > > of the bands under consideration. > > > For example, suppose I want to design the following 2 filters: > > > > > > filter1 > > > passband [0,0.4] magnitude 1.00 allowed ripple: 0.01 > > > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > > > > > > > > > filter2 > > > passband [0,0.4] magnitude 0.5 allowed ripple: 0.01 > > > stopband [0.5,1] magnitude 0 allowed ripple: 0.01 > > > > > > > > > If I feed this information to remezord then for the first filter the > > > returned > > > weight vector will be w = [1 1]. > > > > > > For the 2nd filter it would return w = [1 2]. > > > > > > > > > > > > So even though the allowed ripple is the same for both filters the > > > weight vector remezord returns DOES depend on the band under > > > consideration. > > > > > > So this means remez does not correspond exactly to the > Parks-McClellan > > > design as described in DSP textbooks? > > > What's the reason the remez function uses these scheme for the > weight > > > vectors?