DSPRelated.com
Forums

Estimating transfer function with real poles, complex zeros

Started by Peter Mairhofer May 24, 2017
Hello,

I find it pretty hard to estimate the poles and zeros of the following
transfer function:

https://snag.gy/LOJA3Q.jpg

The raw CSV data is available here https://pastebin.com/ZBshB6eC
(first/third column: frequency in Hz, second column: magnitude in dB,
fourth col: angle in deg).

It comes from a circuit simulator (ac analysis) and I want to use it
with a high level simulation with simulink (just in case - pz analysis
is not supported)

I **do know** about MATLAB `tfest` and it works with one or two poles
and 0-1 zeros, e.g.:

https://snag.gy/6YwWvh.jpg

However, once I increase the number of poles or zeros beyond that, the
result is always garbage. E.g. 3 poles, 2 zeros:

https://snag.gy/zmUynM.jpg

I spent hours, tried all possible options to tfest but without success.
What I particularly dislike is that I supply data only from 1kHz but
tfest estimates arbitrary stuff down to 1e-7 Hz (!).

Qualitatively you can tell that there are at least 3 real-valued poles
(around 300 kHz, 1 GHz, 10 GHz) and one complex-valued zero (400Mhz+/-
1i*300MHz).

Unfortunately, the behavior around the zero is crucial. In fact, I would
need a good estimate between 100kHz and 10GHz.

Can someone help me out?


Thanks,
Peter



On Wednesday, May 24, 2017 at 9:15:27 PM UTC-5, Peter Mairhofer wrote:


> Can someone help me out?
Since you have magnitude *and* phase, FDLS is appropriate: http://robotics.itee.uq.edu.au/~elec3004/2014/lectures/Precise%20Filter%20Design%20(chapter).pdf Matlab or C code is available directly from me. Send PM. Greg
On Friday, May 26, 2017 at 6:18:57 AM UTC+12, Greg Berchin wrote:
> On Wednesday, May 24, 2017 at 9:15:27 PM UTC-5, Peter Mairhofer wrote: > > > > Can someone help me out? > > Since you have magnitude *and* phase, FDLS is appropriate: > http://robotics.itee.uq.edu.au/~elec3004/2014/lectures/Precise%20Filter%20Design%20(chapter).pdf > > Matlab or C code is available directly from me. Send PM. > > Greg
If you have the Bode plot you can get the analogue TF by observation anyway by fitting asymptotes. Why bother with least squares. Once you have analogue you can then use the Bilinear transform to get the digital version - provided you sample at least 10 times higher than the highest frequency of interest. Does this LS method mean you can sample lower and still get a good fit?
On Thursday, May 25, 2017 at 1:46:52 PM UTC-5, gyans...@gmail.com wrote:

> Does this LS method mean you can sample lower and still get a good fit?
FDLS consistently produces closer fits to prototype analog transfer functions than bilinear transform, often by orders of magnitude. (Disclaimer: FDLS is much better at fitting genuine analog transfer functions than it is at fitting arbitrary transfer functions. FDLS is a modeling technique, not really intended to be a filter design technique.) Greg
On Friday, May 26, 2017 at 6:52:43 AM UTC+12, Greg Berchin wrote:
> On Thursday, May 25, 2017 at 1:46:52 PM UTC-5, gyans...@gmail.com wrote: > > > Does this LS method mean you can sample lower and still get a good fit? > > FDLS consistently produces closer fits to prototype analog transfer functions than bilinear transform, often by orders of magnitude. (Disclaimer: FDLS is much better at fitting genuine analog transfer functions than it is at fitting arbitrary transfer functions. FDLS is a modeling technique, not really intended to be a filter design technique.) > > Greg
But you appear to be using time-domain data. Is this not just batch least-squares? There is a recursive least squares version too
On Thursday, May 25, 2017 at 2:39:56 PM UTC-5, gyans...@gmail.com wrote:

> But you appear to be using time-domain data. Is this not just batch least-squares? There is a recursive least squares version too
That's two unrelated topics. Yes, it uses time-domain data. The secret is the form that the data take. Yes, it's batch least squares. So? I also have a recursive implementation with forgetting. Others have created minimax and other implementations.
On Friday, May 26, 2017 at 11:26:29 AM UTC+12, Greg Berchin wrote:
> On Thursday, May 25, 2017 at 2:39:56 PM UTC-5, gyans...@gmail.com wrote: > > > But you appear to be using time-domain data. Is this not just batch least-squares? There is a recursive least squares version too > > That's two unrelated topics. > > Yes, it uses time-domain data. The secret is the form that the data take. > > Yes, it's batch least squares. So? I also have a recursive implementation with forgetting. Others have created minimax and other implementations.
Ok so two things. First of all it doesn't use frequency data then does it? Or do you have another form? Second Batch least squares or Recursive version is very popular, esp in adaptive control systems, self tuning controllers originally
On Thu, 25 May 2017 18:34:45 -0700 (PDT), gyansorova@gmail.com wrote:

>Ok so two things. First of all it doesn't use frequency data then does it?
Yes, it does.
>Second Batch least squares or Recursive version is very popular, esp in adaptive control systems, self tuning controllers originally
Irrelevant.
If you're using a circuit simulator it might give you the poles/zeros locations. I have been using NI Multisim and with some experimentation I got a useful list of poles and zeros for a circuit in the analysis section.  

Greg Berchin <gjberchin@charter.net> writes:

> On Wednesday, May 24, 2017 at 9:15:27 PM UTC-5, Peter Mairhofer wrote: > > >> Can someone help me out? > > Since you have magnitude *and* phase, FDLS is appropriate: > http://robotics.itee.uq.edu.au/~elec3004/2014/lectures/Precise%20Filter%20Design%20(chapter).pdf
Peter, I heartily second Greg's suggestion. When I was designing and implementing a BTSC decoder (the old ATSC stereo decoder) in an all-digital design, FDLS was an essential tool in converting several analog filters to digital form. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com