On Aug 3, 2:55�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
> >>>>>> � � (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-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: � 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 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