Vector Fitting - Custom Pole Spacing

52 views
Skip to first unread message

Andree Scambor

unread,
Feb 13, 2023, 6:50:52 AMFeb 13
to scikit-rf
Hey everyone,
I am currently working on a project of building models for inductors at RF frequency using the VF technique. First of all I want to thank you great people for implementing VF to the skrf toolbox, it saved me a lot of time already :)

I was wondering if it is possible to specify a custom pole spacing for the VF routine, as for inductors using a log/lin spacing often yields underfitted results. I believe the fitting routine tries its best to space the poles on the frequency axis but for inductors there's a big range where there is just a single pole (the main resonance) and then the higher order resonances start at higher frequencies.
This in term leads to an "accumulation" of poles at the main resonant frequency.

If it would be possible to include this feature in a future update, I would be very thankful!
Thanks in advance and I hope you all have a nice day,
Andree

Andree Scambor

unread,
Feb 13, 2023, 6:54:25 AMFeb 13
to scikit-rf
EDIT: I could also do a pull request, if I am to implement that myself, right?

vinc0110

unread,
Feb 13, 2023, 12:08:09 PMFeb 13
to scikit-rf
Hi Andree,

It's nice to hear that you enjoy the VF module in scikit-rf.

Regarding your inductors: how would you space your poles in that scenario? Something like exponential spacing? Surely, you will use some sort of algorithm, which might be useful for others as well.

Contributions on GitHub are always welcome! In this case, I just created a PR for custom pole spacing myself. Feel free to review it and add comments:

Best regards,
Vincent

Andree Scambor

unread,
Feb 13, 2023, 12:42:13 PMFeb 13
to scikit-rf
Hi Vincent,

it's not that sophisticated, honestly. I usually just go with the scipy.signal.find_peaks() and pass it the prominence I want to have for peak detection. This does the job quite well for inductors ;)
Good to know that contributions are welcome! I might do some PRs in the future myself, concerning the passivity assesment of Y and Z parameters, I have to look into which algorithms might fit with the current framework, since there's quite a few...
Great, I'll have a look at it tomorrow!

Cheers from Austria,
Andree

P.S.: a screenshot of what I mean exactly by "accumulation of poles around the main resonance". Model order was set to 27 until the higher order poles were fit appropriately :)
pole_spacing.png

vinc0110

unread,
Feb 13, 2023, 3:20:22 PMFeb 13
to scikit-rf
Hi Andree,

Are you working with measured Z and Y parameters? So far, many functions in the vector fitting module are built around S parameters (except the fitting itself). It would be cool to extend the code for better support of Z and Y parameters, even though most scikit-rf users probably won't need it.

I'm not exactly sure what the plot is showing. Are the lines the successive fits with an increasing number of poles? Is the top grey line the reference to be fitted?

I just tried to fit the S parameters of a Coilcraft inductor, where the data has some sort of nonlinear frequency spacing. It did not work well. Could that be a bug related to your problem? What frequency spacing do you have in your reference data? See issue 846 on GitHub for further discussion: https://github.com/scikit-rf/scikit-rf/issues/846

Vincent

Martin Schöön

unread,
Feb 13, 2023, 3:32:40 PMFeb 13
to scik...@googlegroups.com
Hi all,

This thread tickles my mind as I am guilty of having modelled resistors, capacitors and inductors up to 6 GHz back in the mid 1990s. My models were parametrized equivalent circuit models -- one model per type. Enter nominal component value and the model delivered. Solder lands were included if needed and they do matter.

My work in the field pre-dates both vector fitting and the company that sells model libraries so I am of little help...

It would be fun to dig out some old measurement data and play with vector fitting. Time permitting... :-(

/Martin

Andree Scambor

unread,
Feb 14, 2023, 6:30:00 AMFeb 14
to scikit-rf
Hi everyone,
@Vincent, yes I'm working with Y and Z parameters and am currently trying to get the passivity enforcements for those cases working. I'm using a small script in conjunction with the vf algorithm (which works for Z parameters).
I'll do a PR when I have selected a suitable algorithm, got it to work (stably) and have found a way to implement it with the existing code. There's still work to be done and it's kind of a sideline project for me, so it might take some time though...

Yes, you interpreted it correctly. I believe that the log-spaced poles in the region from 100kHz to 100MHz are kind of "slipping" towards the main res.
Mhm, interesting, I'll comment on github, but I haven't had similar issues as of yet...

@Martin, yeah that's pretty much what we're doing... HF behaviour of electronic components for EMI simulation ;)
Up to 6GHz? No wonder solder lands matter at those frequencies...
Yeah but for half a year now I also didn't know about vector fitting, I just mashed together a bunch of RLC circuits and it works quite well^^
If you're interested, here's the tool I'm developing: https://github.com/Maije2908/Fitting_Algorithm (it's messy engineering code, I apologize in advance)

Andree

vinc0110

unread,
Feb 14, 2023, 1:37:23 PMFeb 14
to scikit-rf
Martin, that sounds nice. Let the digging and playing begin! :-P

Andree, are you aware of the papers by Bjørn Gustavsen, the vector fitting inventor?

So far, I only implemented the passivity assessment and enforcement for S parameters based on these papers:

You can find all of them in a zip bundle on his website (including a matlab implementation):

vinc0110

unread,
Feb 14, 2023, 7:44:02 PMFeb 14
to scikit-rf
Correction:
The passivity enforcement routine is based on this paper: https://ieeexplore.ieee.org/document/4752847
I found their approach much easier to understand and implement.

Andree Scambor

unread,
Feb 15, 2023, 6:26:37 AMFeb 15
to scikit-rf
Yes, I am aware of those of course. Though to be candid, I didn't understand all of it in its full extend^^
I've dug up quite a lot of papers on the subject though... Far as I understand it, there's some approaches relying on matrix perturbation (whether it is the Hamiltonian or some other passivity assesment matrix) and some approaches utilizing convex optimization (but that is very complicated stuff, and I don't think it's worth going the extra mile, since the matrix perturbation approaches work just fine)

I've also picked an easy to follow approach (though it only works for symmetric networks): https://ieeexplore.ieee.org/document/8880538
Yeah I feel you, some of the papers are kind of difficult to reproduce... a detail as simple as some missing indices can significantly complicate the process of getting it to work in code^^

Btw: did you ever run into problems with precision? Because I recently had a problem with the algorithm as I was doing an eigendecomposition and the imaginary part (which was supposed to be 0 for this algo) was at something like 1e-16 to 1e-18^^

vinc0110

unread,
Feb 15, 2023, 12:31:08 PMFeb 15
to scikit-rf
Luckily, it's not always necessary to follow every detail of the mathematical derivations in the papers. Otherwise, I would probably still be working on it :-D

Precision errors have not been a problem so far, at least I did not notice any issues. I guess the formulation of the half-size test matrix by Gustavsen is rather robust in this regard. See for example lines 865-871 in vectorFitting.py, where I do a test for the (real part of the square root of the) eigenvalue to be exactly zero:
if np.real(sqrt_eigenval) == 0.0

Now that you mentioned the requirement for symmetric networks, I remembered that Gustavsen's half-size test matrix also only works in case of symmetric models. So far, this is just silently assumed and not checked in the code. There used to be a check, which is commented out. I guess it did not work and was left for another day...

I think we should continue any detailed discussions on existing or new implementations in the Discussions section of the repo over on GitHub. It makes it much easier to link code lines, write rendered equations and so on. Don't hesitate to open a new thread there.

Andree Scambor

unread,
Feb 15, 2023, 1:15:55 PMFeb 15
to scikit-rf
Yeah well but sometime you have to dig a little to find an algorithm from all that maths :D
I opened a thread here and just continued this conversation *shrug*
Reply all
Reply to author
Forward
0 new messages