From G-parameters to Z-parameters
In matrix form, the formula is
Z=([0001]G+[1000])([1000]G+[0001])−1
While for each element, we obtain
Z11Z12Z21Z22=G111=−G11G12=G11G21=G11G11G22−G12G21
The formulas are obtained with the methods explained here.
The MATLAB implementation can be found in circuitconversions on Gitlab.
Definitions
[I1V2]=G[V1I2] | [V1V2]=Z[I1I2] |