From B-parameters to G-parameters
In matrix form, the formula is
G=([0100]B+[0010])([000−1]B+[1000])−1
While for each element, we obtain
G11G12G21G22=−B22B21=−B221=B22B11B22−B12B21=−B22B12
The formulas are obtained with the methods explained here.
The MATLAB implementation can be found in circuitconversions on Gitlab.
Definitions
[V2−I2]=B[V1I1] | [I1V2]=G[V1I2] |