Reply by Rune Allnor August 3, 20082008-08-03
On 3 Aug, 13:53, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 1 Aug, 04:53, "C Warwick" <c...@notme.com> wrote: > > > Ok, say i have a single pole lowpass filter, 1 pole, no zero. > > > y[0] = c.x[0] + (1-c).y[-1] > > > This is basicly a single pole moving from (0,0) to (1,0) on the real axis. > > And normalized at DC. > > > Now by doing this seperately after the lowpass. > > > highpass = x[0] - y[0] > > > You get a high pass. But i cant get my hed round where the poles (and zeros) > > would be? I dont really see how to combine it into one difference equation > > so i can work backwards to the z-transform / poles/zeros. > > There is a standard way to transform a low-pass prototype filter > with cut-off at w1 to a high-pass filter with cut-off at w2.
I actually have the recipe in my notes. Start with a source LP transfer function H(z) and substitute the following (view with fixed-width font): z^-1 + q z^-1 -> - ---------- (note negative sign on fraction) 1 + q z^-1 where cos[(wp-wc)/2] q = - -------------- (note negative sign on fraction) cos[(wp+wc)/2] and wp is the cut-off frequency of the low-pass prototype and wc is the cut-off frequency of the target high-pass filter. Rune
Reply by Rune Allnor August 3, 20082008-08-03
On 1 Aug, 04:53, "C Warwick" <c...@notme.com> wrote:
> Ok, say i have a single pole lowpass filter, 1 pole, no zero. > > y[0] = c.x[0] + (1-c).y[-1] > > This is basicly a single pole moving from (0,0) to (1,0) on the real axis. > And normalized at DC. > > Now by doing this seperately after the lowpass. > > highpass = x[0] - y[0] > > You get a high pass. But i cant get my hed round where the poles (and zeros) > would be? I dont really see how to combine it into one difference equation > so i can work backwards to the z-transform / poles/zeros.
There is a standard way to transform a low-pass prototype filter with cut-off at w1 to a high-pass filter with cut-off at w2. It's been a while since I played around with those things, but try to look up 'spectral transforms' in the book by Proakis & Manolakis. I know they have a table with these transforms in the chapter on IIR filters, and I also happen to know that there were a couple of typos in that table in their 3rd edition (and presumably earlier editions as well). The typos were corrected in their 4th edition. BTW, the formulas are quite elaborate. If you want to use them to transform filters of arbitrary order, implement the transforms for 1st and 2nd order sections, and represent the higher-order filters (N > 2) as a sequence of 1st and 2nd order sections (is that 'cascade form'?). Rune
Reply by dbell August 3, 20082008-08-03
On Aug 3, 2:55&#4294967295;am, Tim Wescott <t...@seemywebsite.com> wrote:
> dbell wrote: > > On Aug 2, 6:09 pm, Tim Wescott <t...@seemywebsite.com> wrote: > >> dbell wrote: > >>> On Aug 2, 2:24 pm, Tim Wescott <t...@seemywebsite.com> wrote: > >>>> bharat pathak wrote: > >>>> (top posting fixed) > >>>>> //-------------------------- in response to ------------------------ > >>>>>> Transfer function > >>>>>> &#4294967295; &#4294967295; (1+beta) z > >>>>>> H = ---------- > >>>>>> &#4294967295; &#4294967295; &#4294967295;z - beta > >>>>>> Oops -- that's not a high-pass filter at all, it's just a low-pass > >>>>>> filter with a non-unity gain at DC for all beta != 0. > >>>>>> Dangit. > >>>>> //------------------------------------------------------------------ > >>>>> Hello Tim, > >>>>> &#4294967295; &#4294967295; Before passing out your judgement, I think it is better > >>>>> &#4294967295; &#4294967295; to verify things first, specially when matlab code is > >>>>> &#4294967295; &#4294967295; provided it won't take more than a minutes time to run > >>>>> &#4294967295; &#4294967295; it and check the results. Even if you don't have matlab > >>>>> &#4294967295; &#4294967295; octave is freely available. > >>>>> &#4294967295; &#4294967295; As OP found, both approaches lead to HPF. If you are still > >>>>> &#4294967295; &#4294967295; not convinced read page 329 330 and 331 of proakis, manolakis > >>>>> &#4294967295; &#4294967295; 4th Edition. > >>>>> Regards > >>>>> Bharat > >>>>> The day a person thinks he knows everything, is already brain dead. > >>>> I was going from your equations, I generally don't bother looking at > >>>> code. &#4294967295;If your code is correct then more power to you, but that doesn't > >>>> change the fact that your published difference equation is in error. > >>>> If you think that you can find mathematical truths with Matlab when you > >>>> can't even do the basics with pencil and paper then I have only pity for > >>>> you. > >>>> -- > >>>> Tim Wescott > >>>> Wescott Design Serviceshttp://www.wescottdesign.com > >>>> Do you need to implement control loops in software? > >>>> "Applied Control Theory for Embedded Systems" gives you just what it says. > >>>> See details athttp://www.wescottdesign.com/actfes/actfes.html-Hidequoted text - > >>>> - Show quoted text - > >>> Tim, > >>> His HP equations are right. I think the confusion rests on him > >>> changing the sign of beta between the LP and HP equations. For HP, he > >>> has -1<beta<=0. Plug in z=1 for DC gain, z=-1 for max HP gain. It's a > >>> HP. > >>> Dirk > >> Extracting his equations from his text: > > >> LP: &#4294967295; y(n) = (1-beta)*x(n) + beta*y(n-1) > >> "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) > > >> The only difference is the gain of the filter, both are low-pass with a > >> zero at z = 0 and a pole at z = 1-beta. &#4294967295;You can test the DC gain of the > >> high-pass case by assuming that y and x are constant, and you get > > >> y = (1+beta)x + beta*y > >> => (1-beta)y = (1+beta)x > >> => y = x (1+beta)/(1-beta). > > >> And that ain't zero, so that ain't a high pass filter. > > >> -- > > >> Tim Wescott > >> Wescott Design Serviceshttp://www.wescottdesign.com > > >> Do you need to implement control loops in software? > >> "Applied Control Theory for Embedded Systems" gives you just what it says. > >> See details athttp://www.wescottdesign.com/actfes/actfes.html-Hide quoted text - > > >> - Show quoted text - > > > Tim, > > > Who said the gain has to be zero at DC to be a HP? Look at the gains > > at DC and Fs/2 to see the types of filters, and that they are not > > scaled versions of each other. > > > "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) > > > HHP(Z)=(1+beta)/(1-beta*Z^-1), (for beta in ( -1, 0] as Bharat > > specified) > > > At DC &#4294967295; Z= &#4294967295;1, so HHP(Z= 1) = (1+beta)/(1-beta) > > At Fs/2 Z= -1, so HHP(Z=-1) = (1+beta)/(1+beta) = 1.0 > > > Plug in a value for beta, say beta= - 0.9 (negative as Bharat said) > > > At DC &#4294967295; HHP(Z= 1) = (.1)/(1.9) = 0.0526 > > At Fs/2 HHP(Z=-1) = (.1)/(.1) &#4294967295; =1.0 > > > Gain going from DC to Fs/2 goes from 0.0526 to 1.0, almost an increase > > by a factor of 20. > > Alternately you could say the low frequencies are attenuated to as > > little as ~1/20 relative to the highest frequencies. > > > Sounds like a high-pass to me. &#4294967295;Sure isn't a lowpass. > > > "LP": &#4294967295; y(n) = (1-beta)*x(n) + beta*y(n-1), (for beta in [0, 1) as > > Bharat specified) > > > HLP(Z)=(1-beta)/1-beta*Z^-1) > > > At DC &#4294967295; Z= 1, HLP(Z= 1) = (1-beta)/(1-beta) =1.0 > > At Fs/2 Z=-1, HLP(Z=-1) = (1-beta)/(1+beta) > > > Plug in a value for beta, say beta=0.9 (now positive as bharat said) > > > At DC &#4294967295; HLP(Z= 1)=(.1)/(.1) &#4294967295;= 1.0 > > At Fs/2 HLP(Z=-1)=(.1)/(1.9) = 0.0526 > > > Sounds like a low-pass to me. &#4294967295;Sure isn't a high-pass. > > > The two filters are clearly not the same with the exception of a scale > > factor. The equations do look the same except for a scale factor, but > > only until you see that the betas are defined differently. > > > Dirk > > > BTW, for the HP, I used beta= -0.9, but making beta closer to -1 will > > get the DC gain closer to 0, with the Fs/2 gain fixed at 1.0 . > > Where I come from (analog circuit design), that's a lowpass with a > highly resonant peak -- which you can get with Bharat's first equation > just by setting beta < 0. &#4294967295;Just because the resonance happens to be > around Fs/2, and allows one to express the filter as a 1st-order, is a > mathematical curiosity of sampled-time systems. > > _Real_ high pass filters do, indeed, have zero gain at DC (at least > assuming ideal components and no quantization, etc). &#4294967295;Real low pass > filters have zero gain at infinite frequencies, if you're working in a > domain that has such (and yes, you could argue that this implies that > there are no 'real' sampled-time low-pass filters). > > Did I miss that exceptionally screwy bit of mathematical legerdemain? > > Why yes, &#4294967295;I did. &#4294967295;My bad. &#4294967295;I'll have to remember in future just how > profoundly impractical Bharat's posts really are. > > Do I think that there is any wide practical implementation of this filter? > > Why no. &#4294967295;I don't. &#4294967295;Narrow ones, yes. &#4294967295;Wide ones, no. > > He certainly went far afield of the OP's question, which involved making > high-pass filters from low-pass prototypes. &#4294967295;Since you're so hot on this > filter, perhaps you could say how to set beta if I want to have a high > pass filter with a cutoff of Fs/100? > > -- > > Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" gives you just what it says. > See details athttp://www.wescottdesign.com/actfes/actfes.html- Hide quoted text - > > - Show quoted text -
Tim, In digital filters that exhibit characteristics of significant attenuation on a band from DC to F1 and approximately unity gain from some F2 to Fs/2, that would no doubt be called highpass by most DSP people, there is no requirement that gain at DC be 0. Try plot(20*log10(abs(fft(firpm(62,[0 .1 .2 .5]/.5, [ 0 0 1 1],[50,1]), 8000)))) 120 dB stopband attenuation, ripple +-4*10^-4 dB passband ripple about 0 dB, nonzero at DC (actually a peak in the ripple at DC). I do not mistake "real" to mean "analog", so not having 0 at DC doesn't cause me any problem when designing useful digital filters. If I did I would be over at comp.asp instead of here :-). Dirk
Reply by Tim Wescott August 3, 20082008-08-03
bharat pathak wrote:
> Tim, > > I am not using matlab as the mechanism to find out > the truth. > > The equations have already worked out on peice of > paper with pen. i dont have scanner else i would > have scanned and send u the stuff. > > By the way I have also pointed to Proakis and Manolakis > for your reference. > > Both versions, yours and mine are HPF, as Dirk has > rightly pointed out. Yours is slightly better version > as it has added zero at z = 1 (dc point). This is > the main reason why I wanted to point to the book. > > Dirk has also pointed the valid range of beta for > HPF, -1 < beta <= 0. And this is the finer point > which i feel you have missed out. > > Regards > Bharat Pathak > > Arithos Designs > www.Arithos.com
Mine is a "slightly" better version because it'll work in about 999 out of 1000 cases where a first-order high pass filter is needed. Yours will work just dandy for the rest. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Tim Wescott August 3, 20082008-08-03
dbell wrote:
> On Aug 2, 6:09 pm, Tim Wescott <t...@seemywebsite.com> wrote: >> dbell wrote: >>> On Aug 2, 2:24 pm, Tim Wescott <t...@seemywebsite.com> wrote: >>>> bharat pathak wrote: >>>> (top posting fixed) >>>>> //-------------------------- in response to ------------------------ >>>>>> Transfer function >>>>>> (1+beta) z >>>>>> H = ---------- >>>>>> z - beta >>>>>> Oops -- that's not a high-pass filter at all, it's just a low-pass >>>>>> filter with a non-unity gain at DC for all beta != 0. >>>>>> Dangit. >>>>> //------------------------------------------------------------------ >>>>> Hello Tim, >>>>> Before passing out your judgement, I think it is better >>>>> to verify things first, specially when matlab code is >>>>> provided it won't take more than a minutes time to run >>>>> it and check the results. Even if you don't have matlab >>>>> octave is freely available. >>>>> As OP found, both approaches lead to HPF. If you are still >>>>> not convinced read page 329 330 and 331 of proakis, manolakis >>>>> 4th Edition. >>>>> Regards >>>>> Bharat >>>>> The day a person thinks he knows everything, is already brain dead. >>>> I was going from your equations, I generally don't bother looking at >>>> code. If your code is correct then more power to you, but that doesn't >>>> change the fact that your published difference equation is in error. >>>> If you think that you can find mathematical truths with Matlab when you >>>> can't even do the basics with pencil and paper then I have only pity for >>>> you. >>>> -- >>>> Tim Wescott >>>> Wescott Design Serviceshttp://www.wescottdesign.com >>>> Do you need to implement control loops in software? >>>> "Applied Control Theory for Embedded Systems" gives you just what it says. >>>> See details athttp://www.wescottdesign.com/actfes/actfes.html-Hide quoted text - >>>> - Show quoted text - >>> Tim, >>> His HP equations are right. I think the confusion rests on him >>> changing the sign of beta between the LP and HP equations. For HP, he >>> has -1<beta<=0. Plug in z=1 for DC gain, z=-1 for max HP gain. It's a >>> HP. >>> Dirk >> Extracting his equations from his text: >> >> LP: y(n) = (1-beta)*x(n) + beta*y(n-1) >> "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) >> >> The only difference is the gain of the filter, both are low-pass with a >> zero at z = 0 and a pole at z = 1-beta. You can test the DC gain of the >> high-pass case by assuming that y and x are constant, and you get >> >> y = (1+beta)x + beta*y >> => (1-beta)y = (1+beta)x >> => y = x (1+beta)/(1-beta). >> >> And that ain't zero, so that ain't a high pass filter. >> >> -- >> >> Tim Wescott >> Wescott Design Serviceshttp://www.wescottdesign.com >> >> Do you need to implement control loops in software? >> "Applied Control Theory for Embedded Systems" gives you just what it says. >> See details athttp://www.wescottdesign.com/actfes/actfes.html- Hide quoted text - >> >> - Show quoted text - > > Tim, > > Who said the gain has to be zero at DC to be a HP? Look at the gains > at DC and Fs/2 to see the types of filters, and that they are not > scaled versions of each other. > > "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) > > HHP(Z)=(1+beta)/(1-beta*Z^-1), (for beta in ( -1, 0] as Bharat > specified) > > At DC Z= 1, so HHP(Z= 1) = (1+beta)/(1-beta) > At Fs/2 Z= -1, so HHP(Z=-1) = (1+beta)/(1+beta) = 1.0 > > Plug in a value for beta, say beta= - 0.9 (negative as Bharat said) > > At DC HHP(Z= 1) = (.1)/(1.9) = 0.0526 > At Fs/2 HHP(Z=-1) = (.1)/(.1) =1.0 > > Gain going from DC to Fs/2 goes from 0.0526 to 1.0, almost an increase > by a factor of 20. > Alternately you could say the low frequencies are attenuated to as > little as ~1/20 relative to the highest frequencies. > > Sounds like a high-pass to me. Sure isn't a lowpass. > > "LP": y(n) = (1-beta)*x(n) + beta*y(n-1), (for beta in [0, 1) as > Bharat specified) > > HLP(Z)=(1-beta)/1-beta*Z^-1) > > At DC Z= 1, HLP(Z= 1) = (1-beta)/(1-beta) =1.0 > At Fs/2 Z=-1, HLP(Z=-1) = (1-beta)/(1+beta) > > Plug in a value for beta, say beta=0.9 (now positive as bharat said) > > At DC HLP(Z= 1)=(.1)/(.1) = 1.0 > At Fs/2 HLP(Z=-1)=(.1)/(1.9) = 0.0526 > > Sounds like a low-pass to me. Sure isn't a high-pass. > > The two filters are clearly not the same with the exception of a scale > factor. The equations do look the same except for a scale factor, but > only until you see that the betas are defined differently. > > Dirk > > BTW, for the HP, I used beta= -0.9, but making beta closer to -1 will > get the DC gain closer to 0, with the Fs/2 gain fixed at 1.0 . >
Where I come from (analog circuit design), that's a lowpass with a highly resonant peak -- which you can get with Bharat's first equation just by setting beta < 0. Just because the resonance happens to be around Fs/2, and allows one to express the filter as a 1st-order, is a mathematical curiosity of sampled-time systems. _Real_ high pass filters do, indeed, have zero gain at DC (at least assuming ideal components and no quantization, etc). Real low pass filters have zero gain at infinite frequencies, if you're working in a domain that has such (and yes, you could argue that this implies that there are no 'real' sampled-time low-pass filters). Did I miss that exceptionally screwy bit of mathematical legerdemain? Why yes, I did. My bad. I'll have to remember in future just how profoundly impractical Bharat's posts really are. Do I think that there is any wide practical implementation of this filter? Why no. I don't. Narrow ones, yes. Wide ones, no. He certainly went far afield of the OP's question, which involved making high-pass filters from low-pass prototypes. Since you're so hot on this filter, perhaps you could say how to set beta if I want to have a high pass filter with a cutoff of Fs/100? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by dbell August 3, 20082008-08-03
On Aug 2, 6:09&#4294967295;pm, Tim Wescott <t...@seemywebsite.com> wrote:
> dbell wrote: > > On Aug 2, 2:24 pm, Tim Wescott <t...@seemywebsite.com> wrote: > >> bharat pathak wrote: > > >> (top posting fixed) > > >>> //-------------------------- in response to ------------------------ > >>>> Transfer function > >>>> &#4294967295; &#4294967295; (1+beta) z > >>>> H = ---------- > >>>> &#4294967295; &#4294967295; &#4294967295;z - beta > >>>> Oops -- that's not a high-pass filter at all, it's just a low-pass > >>>> filter with a non-unity gain at DC for all beta != 0. > >>>> Dangit. > >>> //------------------------------------------------------------------ > >>> Hello Tim, > >>> &#4294967295; &#4294967295; Before passing out your judgement, I think it is better > >>> &#4294967295; &#4294967295; to verify things first, specially when matlab code is > >>> &#4294967295; &#4294967295; provided it won't take more than a minutes time to run > >>> &#4294967295; &#4294967295; it and check the results. Even if you don't have matlab > >>> &#4294967295; &#4294967295; octave is freely available. > >>> &#4294967295; &#4294967295; As OP found, both approaches lead to HPF. If you are still > >>> &#4294967295; &#4294967295; not convinced read page 329 330 and 331 of proakis, manolakis > >>> &#4294967295; &#4294967295; 4th Edition. > >>> Regards > >>> Bharat > >>> The day a person thinks he knows everything, is already brain dead. > >> I was going from your equations, I generally don't bother looking at > >> code. &#4294967295;If your code is correct then more power to you, but that doesn't > >> change the fact that your published difference equation is in error. > > >> If you think that you can find mathematical truths with Matlab when you > >> can't even do the basics with pencil and paper then I have only pity for > >> you. > > >> -- > > >> Tim Wescott > >> Wescott Design Serviceshttp://www.wescottdesign.com > > >> Do you need to implement control loops in software? > >> "Applied Control Theory for Embedded Systems" gives you just what it says. > >> See details athttp://www.wescottdesign.com/actfes/actfes.html-Hide quoted text - > > >> - Show quoted text - > > > Tim, > > > His HP equations are right. I think the confusion rests on him > > changing the sign of beta between the LP and HP equations. For HP, he > > has -1<beta<=0. Plug in z=1 for DC gain, z=-1 for max HP gain. It's a > > HP. > > > Dirk > > Extracting his equations from his text: > > LP: &#4294967295; y(n) = (1-beta)*x(n) + beta*y(n-1) > "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) > > The only difference is the gain of the filter, both are low-pass with a > zero at z = 0 and a pole at z = 1-beta. &#4294967295;You can test the DC gain of the > high-pass case by assuming that y and x are constant, and you get > > y = (1+beta)x + beta*y > => (1-beta)y = (1+beta)x > => y = x (1+beta)/(1-beta). > > And that ain't zero, so that ain't a high pass filter. > > -- > > Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" gives you just what it says. > See details athttp://www.wescottdesign.com/actfes/actfes.html- Hide quoted text - > > - Show quoted text -
Tim, Who said the gain has to be zero at DC to be a HP? Look at the gains at DC and Fs/2 to see the types of filters, and that they are not scaled versions of each other. "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) HHP(Z)=(1+beta)/(1-beta*Z^-1), (for beta in ( -1, 0] as Bharat specified) At DC Z= 1, so HHP(Z= 1) = (1+beta)/(1-beta) At Fs/2 Z= -1, so HHP(Z=-1) = (1+beta)/(1+beta) = 1.0 Plug in a value for beta, say beta= - 0.9 (negative as Bharat said) At DC HHP(Z= 1) = (.1)/(1.9) = 0.0526 At Fs/2 HHP(Z=-1) = (.1)/(.1) =1.0 Gain going from DC to Fs/2 goes from 0.0526 to 1.0, almost an increase by a factor of 20. Alternately you could say the low frequencies are attenuated to as little as ~1/20 relative to the highest frequencies. Sounds like a high-pass to me. Sure isn't a lowpass. "LP": y(n) = (1-beta)*x(n) + beta*y(n-1), (for beta in [0, 1) as Bharat specified) HLP(Z)=(1-beta)/1-beta*Z^-1) At DC Z= 1, HLP(Z= 1) = (1-beta)/(1-beta) =1.0 At Fs/2 Z=-1, HLP(Z=-1) = (1-beta)/(1+beta) Plug in a value for beta, say beta=0.9 (now positive as bharat said) At DC HLP(Z= 1)=(.1)/(.1) = 1.0 At Fs/2 HLP(Z=-1)=(.1)/(1.9) = 0.0526 Sounds like a low-pass to me. Sure isn't a high-pass. The two filters are clearly not the same with the exception of a scale factor. The equations do look the same except for a scale factor, but only until you see that the betas are defined differently. Dirk BTW, for the HP, I used beta= -0.9, but making beta closer to -1 will get the DC gain closer to 0, with the Fs/2 gain fixed at 1.0 .
Reply by bharat pathak August 3, 20082008-08-03
Tim,

   I am not using matlab as the mechanism to find out
   the truth.

   The equations have already worked out on peice of 
   paper with pen. i dont have scanner else i would
   have scanned and send u the stuff. 

   By the way I have also pointed to Proakis and Manolakis
   for your reference.

   Both versions, yours and mine are HPF, as Dirk has
   rightly pointed out. Yours is slightly better version
   as it has added zero at z = 1 (dc point). This is
   the main reason why I wanted to point to the book.

   Dirk has also pointed the valid range of beta for
   HPF, -1 < beta <= 0. And this is the finer point
   which i feel you have missed out.

Regards
Bharat Pathak

Arithos Designs
www.Arithos.com




 

Reply by Tim Wescott August 2, 20082008-08-02
dbell wrote:
> On Aug 2, 2:24 pm, Tim Wescott <t...@seemywebsite.com> wrote: >> bharat pathak wrote: >> >> (top posting fixed) >> >> >> >> >> >>> //-------------------------- in response to ------------------------ >>>> Transfer function >>>> (1+beta) z >>>> H = ---------- >>>> z - beta >>>> Oops -- that's not a high-pass filter at all, it's just a low-pass >>>> filter with a non-unity gain at DC for all beta != 0. >>>> Dangit. >>> //------------------------------------------------------------------ >>> Hello Tim, >>> Before passing out your judgement, I think it is better >>> to verify things first, specially when matlab code is >>> provided it won't take more than a minutes time to run >>> it and check the results. Even if you don't have matlab >>> octave is freely available. >>> As OP found, both approaches lead to HPF. If you are still >>> not convinced read page 329 330 and 331 of proakis, manolakis >>> 4th Edition. >>> Regards >>> Bharat >>> The day a person thinks he knows everything, is already brain dead. >> I was going from your equations, I generally don't bother looking at >> code. If your code is correct then more power to you, but that doesn't >> change the fact that your published difference equation is in error. >> >> If you think that you can find mathematical truths with Matlab when you >> can't even do the basics with pencil and paper then I have only pity for >> you. >> >> -- >> >> Tim Wescott >> Wescott Design Serviceshttp://www.wescottdesign.com >> >> Do you need to implement control loops in software? >> "Applied Control Theory for Embedded Systems" gives you just what it says. >> See details athttp://www.wescottdesign.com/actfes/actfes.html- Hide quoted text - >> >> - Show quoted text - > > Tim, > > His HP equations are right. I think the confusion rests on him > changing the sign of beta between the LP and HP equations. For HP, he > has -1<beta<=0. Plug in z=1 for DC gain, z=-1 for max HP gain. It's a > HP. > > Dirk
Extracting his equations from his text: LP: y(n) = (1-beta)*x(n) + beta*y(n-1) "HP": y(n) = (1+beta)*x(n) + beta*y(n-1) The only difference is the gain of the filter, both are low-pass with a zero at z = 0 and a pole at z = 1-beta. You can test the DC gain of the high-pass case by assuming that y and x are constant, and you get y = (1+beta)x + beta*y => (1-beta)y = (1+beta)x => y = x (1+beta)/(1-beta). And that ain't zero, so that ain't a high pass filter. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by dbell August 2, 20082008-08-02
On Aug 2, 2:24&#4294967295;pm, Tim Wescott <t...@seemywebsite.com> wrote:
> bharat pathak wrote: > > (top posting fixed) > > > > > > > //-------------------------- in response to ------------------------ > > >> Transfer function > > >> &#4294967295; &#4294967295; (1+beta) z > >> H = ---------- > >> &#4294967295; &#4294967295; &#4294967295;z - beta > > >> Oops -- that's not a high-pass filter at all, it's just a low-pass > >> filter with a non-unity gain at DC for all beta != 0. > > >> Dangit. > > > //------------------------------------------------------------------ > > > Hello Tim, > > > &#4294967295; &#4294967295; Before passing out your judgement, I think it is better > > &#4294967295; &#4294967295; to verify things first, specially when matlab code is > > &#4294967295; &#4294967295; provided it won't take more than a minutes time to run > > &#4294967295; &#4294967295; it and check the results. Even if you don't have matlab > > &#4294967295; &#4294967295; octave is freely available. > > > &#4294967295; &#4294967295; As OP found, both approaches lead to HPF. If you are still > > &#4294967295; &#4294967295; not convinced read page 329 330 and 331 of proakis, manolakis > > &#4294967295; &#4294967295; 4th Edition. > > > Regards > > Bharat > > > The day a person thinks he knows everything, is already brain dead. > > I was going from your equations, I generally don't bother looking at > code. &#4294967295;If your code is correct then more power to you, but that doesn't > change the fact that your published difference equation is in error. > > If you think that you can find mathematical truths with Matlab when you > can't even do the basics with pencil and paper then I have only pity for > you. > > -- > > Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" gives you just what it says. > See details athttp://www.wescottdesign.com/actfes/actfes.html- Hide quoted text - > > - Show quoted text -
Tim, His HP equations are right. I think the confusion rests on him changing the sign of beta between the LP and HP equations. For HP, he has -1<beta<=0. Plug in z=1 for DC gain, z=-1 for max HP gain. It's a HP. Dirk
Reply by Tim Wescott August 2, 20082008-08-02
bharat pathak wrote:
(top posting fixed)
> //-------------------------- in response to ------------------------ > >> Transfer function >> >> (1+beta) z >> H = ---------- >> z - beta >> >> Oops -- that's not a high-pass filter at all, it's just a low-pass >> filter with a non-unity gain at DC for all beta != 0. >> >> Dangit. > > //------------------------------------------------------------------ > > Hello Tim, > > Before passing out your judgement, I think it is better > to verify things first, specially when matlab code is > provided it won't take more than a minutes time to run > it and check the results. Even if you don't have matlab > octave is freely available. > > As OP found, both approaches lead to HPF. If you are still > not convinced read page 329 330 and 331 of proakis, manolakis > 4th Edition. > > Regards > Bharat > > The day a person thinks he knows everything, is already brain dead.
I was going from your equations, I generally don't bother looking at code. If your code is correct then more power to you, but that doesn't change the fact that your published difference equation is in error. If you think that you can find mathematical truths with Matlab when you can't even do the basics with pencil and paper then I have only pity for you. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html