DSPRelated.com
Forums

Analog to digital filter conversion

Started by mortjo October 17, 2005
Hi

This might be one of those oh-no-not-again questions, but please help as i
am a bit of a novice in DSP.

The question is: How do i get from an analog circuit of an RLC filter to a
digital filter (IIR or FIR) that has approximately the same magnitude and
phase response?

Please do not answer: You use the bilinear transform, as I need some
step-by-step guidance here. Something like a link to a tutorial or a
reference to a book that explains an algorithm for doing it in small and
simple steps that even I am capcble of following :-)

Thanks!

/MJ


		
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
mortjo wrote:
> Hi > > This might be one of those oh-no-not-again questions, but please help as i > am a bit of a novice in DSP. > > The question is: How do i get from an analog circuit of an RLC filter to a > digital filter (IIR or FIR) that has approximately the same magnitude and > phase response? > > Please do not answer: You use the bilinear transform, as I need some > step-by-step guidance here. Something like a link to a tutorial or a > reference to a book that explains an algorithm for doing it in small and > simple steps that even I am capcble of following :-) > > Thanks!
There are some tools in Matlab that sort of automate the process, but you still have to know what you're doing.
> > /MJ > > > > This message was sent using the Comp.DSP web interface on > www.DSPRelated.com
mortjo wrote:
> Hi > > This might be one of those oh-no-not-again questions, but please help as i > am a bit of a novice in DSP. > > The question is: How do i get from an analog circuit of an RLC filter to a > digital filter (IIR or FIR) that has approximately the same magnitude and > phase response? > > Please do not answer: You use the bilinear transform, as I need some > step-by-step guidance here. Something like a link to a tutorial or a > reference to a book that explains an algorithm for doing it in small and > simple steps that even I am capcble of following :-) > > Thanks! > > /MJ > > > > This message was sent using the Comp.DSP web interface on > www.DSPRelated.com
First, you probably don't want an FIR; you've got a continuous-time IIR now and you want to preserve the phase response so going to a discrete-time IIR is probably the way to go. Second, here's the bilinear transform in a nutshell: You can represent the z in the z transform as z = e^sT. If you take this approximation, expand it with the Taylor's series and truncate you get z ~ 1 + sT, where T is the sampling rate, of course. This leads to some OK approximations, namely s ~ (z-1)/T and s ~ (z-1)/(zT) but you can do better with s ~ 2(z-1)/(T(z+1)). That's the Tustin approximation, and it's a bilinear transform. So get your filter transfer function in terms of s: H(s) and just plug in the Tustin approximation: ( 2 z-1 ) H( - --- ) ( T z+1 ) Crank out _lots_ of tedious math and you get an answer. This technique has a problem in that the frequencies of the poles and zeros shift around. In addition the reconstruction process where you run the signal through a zero-order hold tends to do odd things to the spectrum at the high end. If you're going to sample lower than 1/10 the highest radian frequency of any of your filter poles then you should prewarp the transfer function -- and I'm not going to attempt to describe that. Instead, I'm going to refer you to "Understanding Digital Signal Processing" by Lyons (who can sometimes be found on this group). He's got a whole chapter on IIR filter design with a fairly long section on the bilinear transform, including prewarping. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
in article 5aidnc6lasYwKs7eRVn-pw@giganews.com, mortjo at mortjo@e-box.dk
wrote on 10/17/2005 10:39:

> The question is: How do i get from an analog circuit of an RLC filter to a > digital filter (IIR or FIR) that has approximately the same magnitude and > phase response? > > Please do not answer: You use the bilinear transform, as I need some > step-by-step guidance here. Something like a link to a tutorial or a > reference to a book that explains an algorithm for doing it in small and > simple steps that even I am capcble of following :-)
have you tried Googling "Bilinear Transform"? there is a rich response to that. i particularly like Julius's page: http://ccrma.stanford.edu/~jos/bbt/Bilinear_Transform.html one (or two) quick question, have you been able to derive an analog filter transfer function, H(s), for your RLC circuit? converting that to a digital filter transfer function, H(z), is trivial, but then, do you know how to convert a digital filter transfer function to a signal flow diagram (something you could use to code a digital filter)? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
I found the examples in Richard Lyons, Understanding Digital Signal
Processing book to be very helpful in understanding the application of
implementing the Bilinear Transform, as well as the Impulse Invariance
Method, when I began studying DSP.   In the book, he takes you through
the process step by step pointing out ways to simplify the algebra,
which is probably one of the worst parts of the process.

Hi again

Thanks for all the replies - the filter is now up and running.

/MJ

>Hi > >This might be one of those oh-no-not-again questions, but please help as
i
>am a bit of a novice in DSP. > >The question is: How do i get from an analog circuit of an RLC filter to
a
>digital filter (IIR or FIR) that has approximately the same magnitude
and
>phase response? > >Please do not answer: You use the bilinear transform, as I need some >step-by-step guidance here. Something like a link to a tutorial or a >reference to a book that explains an algorithm for doing it in small and >simple steps that even I am capcble of following :-) > >Thanks! > >/MJ > > > >This message was sent using the Comp.DSP web interface on >www.DSPRelated.com >
This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Personally, I'd use a software package that lets me input analog
parameters (eg s-domain, poles/zeroes, whatever) and from those will
calculate the FIR coefficients. Most probably do so, I know QEDesign
does: www.mds.com

Chris
===================
Chris Bore
www.bores.com

On 17 Oct 2005 10:14:30 -0700, "Noway2" <no_spam_me2@hotmail.com>
wrote:

>I found the examples in Richard Lyons, Understanding Digital Signal >Processing book to be very helpful in understanding the application of >implementing the Bilinear Transform, as well as the Impulse Invariance >Method, when I began studying DSP. In the book, he takes you through >the process step by step pointing out ways to simplify the algebra, >which is probably one of the worst parts of the process.
Hi Noway2, I'm tickled my book was of some value to you. I'll be happy to send you an errata for the the book if you can tell me the Edition Number (1st or 2nd) and exactly what is the "Printing Number" of your copy of the book. You can find your "Printing Number" on the page just before the "Dedication" page. On that page (before the Dedication) you'll see all sorts of publisher-related information. Down toward the bottom of the page you should see lines that say: Printed in the United States of America First Printing However, it my have the words "Second Printing" or "Third Printing". Please let me know which "Printing Number" (in words) you have, and then I'll know which version of the errata I should send to you. See Ya, [-Rick-]
The Signal Processing Toolbox for O-Matrix, http://www.omatrix.com/spt.html
includes functions for this and provides source code so it might be helpful.

"mortjo" <mortjo@e-box.dk> wrote in message 
news:5aidnc6lasYwKs7eRVn-pw@giganews.com...
> Hi > > This might be one of those oh-no-not-again questions, but please help as i > am a bit of a novice in DSP. > > The question is: How do i get from an analog circuit of an RLC filter to a > digital filter (IIR or FIR) that has approximately the same magnitude and > phase response? > > Please do not answer: You use the bilinear transform, as I need some > step-by-step guidance here. Something like a link to a tutorial or a > reference to a book that explains an algorithm for doing it in small and > simple steps that even I am capcble of following :-) > > Thanks! > > /MJ > > > > This message was sent using the Comp.DSP web interface on > www.DSPRelated.com
Hi Rick,

Thank you, that is a very kind offer.  As far as I can tell, the book
would have to be the first edition as there is no indication of there
being a second.  On the page before the dedication, at the bottom of
the page, is a note that indicates that it is the fifth printing in
June of 1999.