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. Thanks. :-)
Single pole lowpass --> highpass - z transform?
Started by ●July 31, 2008
Reply by ●August 1, 20082008-08-01
first of all let me correct your equation, and also write it in slightly better form, more understandable. y(n) = (1-beta)*x(n) + beta*y(n-1) This system has 1 zero at origin of z-plane (i.e. at z = 0) This system has 1 pole at z = beta where 0 <= beta < 1 (at 1 we have an unstable system) and will act like a low pass filter. %-------------------------------------------------------------- For high pass the difference equation changes to y(n) = (1+beta)*x(n) + beta*y(n-1) where -1 < beta <= 0 (at -1 we again have unstable system This hpf has one zero at z = 0 (origin of zplane) and has one pole at z = beta. %------------------ matlab code attached ---------------------- clear all; close all %--------------------------------- LPF section beta = 0 : 1/8 : 7/8; figure; hold on; for i = 1 : length(beta) num = 1-beta(i); den = [1 -beta(i)]; [hz,f] = freqz(num, den, 1024, 2); plot(f, 20*log10(abs(hz))); end %--------------------------------- HPF section beta = -7/8 : 1/8 : 0; for i = 1 : length(beta) num = 1+beta(i); den = [1 -beta(i)]; [hz,f] = freqz(num, den, 1024, 2); plot(f, 20*log10(abs(hz))); end %----------------------------- matlab code ends. Thanks and Best Regards Bharat Pathak Arithos Designs www.Arithos.com DSP Design Consultancy and Corporate Training Company.
Reply by ●August 1, 20082008-08-01
bharat pathak wrote:> first of all let me correct your equation, and also write > it in slightly better form, more understandable. > > y(n) = (1-beta)*x(n) + beta*y(n-1) > > This system has 1 zero at origin of z-plane (i.e. at z = 0) > This system has 1 pole at z = beta > > where 0 <= beta < 1 (at 1 we have an unstable system) > > and will act like a low pass filter.transfer function (1-beta) z H = ---------- z - beta> > %-------------------------------------------------------------- > > For high pass the difference equation changes to > > y(n) = (1+beta)*x(n) + beta*y(n-1) > > where -1 < beta <= 0 (at -1 we again have unstable system > > This hpf has one zero at z = 0 (origin of zplane) > and has one pole at z = beta.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.> > %------------------ matlab code attached ---------------------- > > clear all; > close all > > %--------------------------------- LPF section > > beta = 0 : 1/8 : 7/8; > figure; hold on; > for i = 1 : length(beta) > num = 1-beta(i); > den = [1 -beta(i)]; > [hz,f] = freqz(num, den, 1024, 2); > plot(f, 20*log10(abs(hz))); > end > > %--------------------------------- HPF section > > beta = -7/8 : 1/8 : 0; > for i = 1 : length(beta) > num = 1+beta(i); > den = [1 -beta(i)]; > [hz,f] = freqz(num, den, 1024, 2); > plot(f, 20*log10(abs(hz))); > end > > %----------------------------- matlab code ends. > > Thanks and Best Regards > Bharat Pathak > > Arithos Designs > www.Arithos.com > > DSP Design Consultancy and Corporate Training Company. > >-- 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 ●August 1, 20082008-08-01
C Warwick 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. > > Thanks. > > :-) >Using d = 1-c: Lowpass: y(k) = (1-d)u(k) + d y(k-1) Transfer function = (1-d) z H = ------- z - d Highpass: y(k) = (1-d)(u(k) - x(k-1)); x(k) = x(k-1) + y(k); You can achieve it with a single difference equation, but only at the expense of carrying an extra state: y(k) = u(k) - u(k-1) + d y(k-1) In both cases (assuming I dotted my 'i's and crossed my 't's), the transfer function is z - 1 H = ------- z - d The pole is at z = d, the low pass has a zero at z = 0, and the high pass has a zero at z = 1. -- 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 ●August 1, 20082008-08-01
"Tim Wescott" <tim@seemywebsite.com> wrote in message news:AMqdnbRWOdjQNg_VnZ2dnUVZ_tCdnZ2d@web-ster.com...>C Warwick 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. >> >> Thanks. >> >> :-) > Using d = 1-c: > > Lowpass: > > y(k) = (1-d)u(k) + d y(k-1) > > Transfer function = > > (1-d) z > H = ------- > z - d > > Highpass: > > y(k) = (1-d)(u(k) - x(k-1)); > x(k) = x(k-1) + y(k); > > You can achieve it with a single difference equation, but only at the > expense of carrying an extra state: > > y(k) = u(k) - u(k-1) + d y(k-1) > > In both cases (assuming I dotted my 'i's and crossed my 't's), the > transfer function is > > z - 1 > H = ------- > z - d > > The pole is at z = d, the low pass has a zero at z = 0, and the high pass > has a zero at z = 1.I tried both highpasses and i get identical frequency response. Regarding the zero i missed out of my 1 pole lowpass. Now i think about it i guess you need at least one zero or else there'll be no input? But the zero being at (0,0) means it contributes no magnitude, just some extra phase shift. thanks :-)
Reply by ●August 2, 20082008-08-02
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. //-------------------------- 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.//------------------------------------------------------------------
Reply by ●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
Reply by ●August 2, 20082008-08-02
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
Reply by ●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. > > DirkExtracting 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 ●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