# Vector Fitting¶

This is a brief introduction to Vector Fitting. The concept and its algorithm was proposed in 1999 by Bjørn Gustavsen and Adam Semlyen . See the Vector Fitting website for more information . The main application of Vector Fitting is to model the original sampled frequency responses of an active or passive device in a circuit simulator. Also see the API documentation and the application examples for more information about the implementation in scikit-rf.

## Mathematical Description¶

The idea of Vector Fitting is to fit a set of rational model functions to a set of sampled frequency responses $$\mathbf{\underline{H}}_\mathrm{sampled}$$, for example from a S, Y or Z matrix. The model function $$\mathbf{\underline{H}}(\mathrm{\underline{s}})$$ is defined in the Laplace domain with $$\mathrm{\underline{s}} = \sigma + \mathrm{j} \omega$$: \begin{equation} \mathbf{\underline{H}}(\mathrm{\underline{s}}) = \mathbf{d} + \mathrm{\underline{s}} \mathbf{e} + \sum_{k=1}^K \frac{\underline{\mathbf{c}}_{k}}{\mathrm{\underline{s}}-\underline{p}_k} \end{equation}

For the desired fit, that model function shall match the given frequency responses at each of its frequency samples $$\omega_n$$: \begin{equation} \mathbf{\underline{H}}(\mathrm{\underline{s}} = \mathrm{j} \omega_n) \overset{!}{=} \mathbf{\underline{H}}_\mathrm{sampled}(\omega_n) \end{equation}

Generally, $$\mathbf{\underline{H}}(\mathrm{\underline{s}})$$ is a vector holding the individual complex frequency responses $$\underline{H}_1(\mathrm{\underline{s}})$$, $$\underline{H}_2(\mathrm{\underline{s}})$$, …, $$\underline{H}_M(\mathrm{\underline{s}})$$ of the model. All elements in $$\mathbf{\underline{H}}(\mathrm{\underline{s}})$$ share a common set of complex poles $$\underline{p}_k$$, but have individual sets of complex residues $$\mathbf{\underline{c}}_k$$, real constants $$\mathbf{d}$$ and real proportional coefficients $$\mathbf{e}$$, which are therefore vectors as well: \begin{equation} \mathbf{\underline{p}} = \begin{pmatrix} \underline{p}_1 & \underline{p}_2 & \underline{p}_3 & \cdots & \underline{p}_K \end{pmatrix} \end{equation}

\begin{equation} \mathbf{\underline{c}} = \begin{pmatrix} \underline{c}_{1,1} & \underline{c}_{2,1} & \underline{c}_{3,1} & \cdots & \underline{c}_{K,1} \\ \underline{c}_{1,2} & \underline{c}_{2,2} & \underline{c}_{3,2} & \cdots & \underline{c}_{K,2} \\ \vdots\\ \underline{c}_{1,M} & \underline{c}_{2,M} & \underline{c}_{3,M} & \cdots & \underline{c}_{K,M} \\ \end{pmatrix} \end{equation}

\begin{equation} \mathbf{d} = \begin{pmatrix} d_1 \\ d_2 \\ \vdots \\ d_M \end{pmatrix} \end{equation}

\begin{equation} \mathbf{e} = \begin{pmatrix} e_1 \\ e_2 \\ \vdots \\ e_M \end{pmatrix} \end{equation}

The number of poles, $$K$$, required for a good fit of $$\mathbf{\underline{H}}(\mathrm{\underline{s}})$$ to $$\mathbf{\underline{H}}_\mathrm{sampled}$$ depends on the shape of the responses.

As an example, the goal could be to fit the rational model function to the S matrix of a 2-port ($$M = 4$$) sampled at $$N$$ frequencies $$\omega_n$$:

\begin{equation} \begin{pmatrix} \underline{S}_{11}(\omega_1) \\ \underline{S}_{12}(\omega_1) \\ \underline{S}_{21}(\omega_1) \\ \underline{S}_{22}(\omega_1) \\ \vdots \\ \underline{S}_{11}(\omega_\mathrm{N}) \\ \underline{S}_{12}(\omega_\mathrm{N}) \\ \underline{S}_{21}(\omega_\mathrm{N}) \\ \underline{S}_{22}(\omega_\mathrm{N}) \end{pmatrix} \overset{!}{=} \begin{pmatrix} d_{11} + \mathrm{j} \omega_1 e_{11} + \sum_{k=1}^K \frac{\underline{c}_{k,11}}{\mathrm{j} \omega_1 - \underline{p}_k} \\ d_{12} + \mathrm{j} \omega_1 e_{12} + \sum_{k=1}^K \frac{\underline{c}_{k,12}}{\mathrm{j} \omega_1 - \underline{p}_k} \\ d_{21} + \mathrm{j} \omega_1 e_{21} + \sum_{k=1}^K \frac{\underline{c}_{k,21}}{\mathrm{j} \omega_1 - \underline{p}_k} \\ d_{22} + \mathrm{j} \omega_1 e_{22} + \sum_{k=1}^K \frac{\underline{c}_{k,22}}{\mathrm{j} \omega_1 - \underline{p}_k} \\ \vdots \\ d_{11} + \mathrm{j} \omega_\mathrm{N} e_{11} + \sum_{k=1}^K \frac{\underline{c}_{k,11}}{\mathrm{j} \omega_\mathrm{N} - \underline{p}_k} \\ d_{12} + \mathrm{j} \omega_\mathrm{N} e_{12} + \sum_{k=1}^K \frac{\underline{c}_{k,12}}{\mathrm{j} \omega_\mathrm{N} - \underline{p}_k} \\ d_{21} + \mathrm{j} \omega_\mathrm{N} e_{21} + \sum_{k=1}^K \frac{\underline{c}_{k,21}}{\mathrm{j} \omega_\mathrm{N} - \underline{p}_k} \\ d_{22} + \mathrm{j} \omega_\mathrm{N} e_{22} + \sum_{k=1}^K \frac{\underline{c}_{k,22}}{\mathrm{j} \omega_\mathrm{N} - \underline{p}_k} \end{pmatrix} \end{equation}

During the Vector Fitting process, the model parameters $$\mathbf{\underline{p}}$$, $$\mathbf{\underline{c}}$$, $$\mathbf{d}$$ and $$\mathbf{e}$$ will be optimized in an iterative manner until a good fit is achieved.

## Equivalent Electrical Circuits¶

The benefit of Vector Fitting the sampled frequency responses is the easy representation of the rational basis function with equivalent electrical circuits. A detailed derivation can be found in .

### Constant and Proportional Term¶

The constant and proportional terms $$\mathbf{d} + \mathrm{\underline{s}} \mathbf{e}$$ can be represented in an electrical circuit by equivalent impedances $$\underline{Z}_\mathrm{RL}(\mathrm{\underline{s}})$$ or equivalent admittances $$\underline{Y}_\mathrm{RC}(\mathrm{\underline{s}})$$ build out of a series RL or parallel RC circuits.  Target response of the constant and proportional term: \begin{equation} \underline{H}_\mathrm{target}(\mathrm{\underline{s}}) = d_i + \mathrm{\underline{s}} e_i \end{equation}

#### Impedance of a series RL circuit:¶

\begin{equation} \underline{Z}_\mathrm{RL}(\mathrm{\underline{s}}) = R + \mathrm{\underline{s}} L \end{equation} This impedance matches the target response if $$R = d_i$$ and $$L = e_i$$.

#### Admittance of a parallel RC circuit:¶

\begin{equation} \underline{Y}_\mathrm{RC}(\mathrm{\underline{s}}) = \frac{1}{R} + \mathrm{\underline{s}} C \end{equation} This admittance matches the target response if $$R = \frac{1}{d_i}$$ and $$C = e_i$$.

### Real Poles and Residues¶

The individual terms $$\frac{c_{k,i}}{\mathrm{\underline{s}} - p_{k,i}}$$ of the fit with a real pole $$p_{k,i}$$ and a real residue $$c_{k,i}$$ can be represented in an electrical circuit by equivalent impedances $$\underline{Z}_\mathrm{RC}(\mathrm{\underline{s}})$$ or equivalent admittances $$\underline{Y}_\mathrm{RL}(\mathrm{\underline{s}})$$ build out of a parallel RC or series RL circuits.

Target response of the real pole-residue term: \begin{equation} \underline{H}_\mathrm{target}(\mathrm{\underline{s}}) = \frac{c_{k,i}}{\mathrm{\underline{s}} - p_{k,i}} \end{equation}

#### Impedance of a parallel RC circuit:¶

The parallel RC circuit is the same as above for the constant and proportional term, but this time its impedance $$\underline{Z}_\mathrm{RC}(\mathrm{\underline{s}})$$ is used instead of its admittance: \begin{equation} \underline{Z}_\mathrm{RC}(\mathrm{\underline{s}}) = \frac{\frac{1}{C}}{\mathrm{\underline{s}} + \frac{1}{RC}} \end{equation} This impedance matches the target response if $$C = \frac{1}{c_{k,i}}$$ and $$R = \frac{c_{k,i}}{-p_{k,i}}$$.

#### Admittance of a series RL circuit:¶

The series RL circuit is the same as above for the constant and proportional term, but this time its admittance $$\underline{Y}_\mathrm{RL}(\mathrm{\underline{s}})$$ is used instead of its impedance: \begin{equation} \underline{Y}_\mathrm{RL}(\mathrm{\underline{s}}) = \frac{\frac{1}{L}}{\mathrm{\underline{s}} + \frac{R}{L}} \end{equation} This admittance matches the target response if $$L = \frac{1}{c_{k,i}}$$ and $$R = \frac{-p_{k,i}}{c_{k,i}}$$.

### Complex Conjugate Poles and Residues¶

In Vector Fitting, complex poles $$\underline{p}_k = p'_k + \mathrm{j} p''_k$$ and residues $$\underline{c}_k = c'_k + \mathrm{j} c''_k$$ always come in complex conjugate pairs $$(\underline{p}_k, \underline{p}_k^*)$$ and $$(\underline{c}_k, \underline{c}_k^*)$$. The target response for an equivalent electrical circuit of such a complex conjugate pair is therefore:

\begin{equation} \underline{H}_\mathrm{target}(\mathrm{\underline{s}}) = \frac{\underline{c}_k}{\mathrm{\underline{s}} - \underline{p}_k} + \frac{\underline{c}^*_k}{\mathrm{\underline{s}} - \underline{p}^*_k} = \frac{2 c'_k \mathrm{\underline{s}} - 2 (c'_k p'_k + c''_k p''_k)}{\mathrm{\underline{s}}^2 - 2 p'_k \mathrm{\underline{s}} + |\underline{p}_k|^2} \end{equation}

There are different ways to build an equivalent circuit out of passive or active components, which can be dimensioned to match this target frequency response. Four such circuits are presented and analyzed in , for example a series RLC circuit combined with a parallel current source controlled by the voltage over the capacitor. This circuit is providing an admittance $$\underline{Y}_\mathrm{RCL,I}(\mathrm{\underline{s}})$$ that can be matched to the target response:

\begin{equation} \underline{Y}_\mathrm{RCL,I}(\mathrm{\underline{s}}) = \frac{1/L \mathrm{\underline{s}} + b}{\mathrm{\underline{s}}^2 + R/L \mathrm{\underline{s}} + 1 / (LC)} \end{equation}

This admittance matches the target response if $$L = \frac{1}{2 c'_k}$$, $$R = \frac{-p'_k}{ c'_k}$$, $$C = \frac{2 c'_k}{|\underline{p}_k|^2}$$ and $$b = -2 (c'_k p'_k + c''_k p''_k)$$ with $$g_\mathrm{m} = bLC = \frac{b}{|\underline{p}_k|^2}$$.

## Equivalent Circuit of a Vector Fitted $$N$$-Port¶

### Case 1: Vector Fitted S Parameters¶

The equivalent circuit of a $$N$$-port with a Vector Fitted S matrix consists of an interface network and a transfer network for each port. The figure below shows the structure of the interface and transfer networks of one such port $$i$$ with the external port voltage $$V_i$$ and port current $$I_i$$. The individual frequency responses $$\underline{S}_{i,j}$$ of the Vector Fit are reproduced with the equivalent admittances $$\underline{Y}_{\mathrm{S},i,j}$$ based on the fitting parameters $$\mathbf{\underline{p}}$$, $$\mathbf{\underline{c}}$$, $$\mathbf{d}$$ and $$\mathbf{e}$$ as described above. ### Case 2: Vector Fitted Y Parameters¶

Not implemented. See Y Parameters for a general equivalent circuit.

### Case 3: Vector Fitted Z Parameters¶

Not implemented. See Z Parameters for a general equivalent circuit.