From B-parameters to Z-parameters
In matrix form, the formula is
Z=([0100]B+[1000])([000−1]B+[0010])−1
While for each element, we obtain
Z11Z12Z21Z22=−B21B22=−B211=−B21B11B22−B12B21=−B21B11
The formulas are obtained with the methods explained here.
The MATLAB implementation can be found in circuitconversions on Gitlab.
Definitions
[V2−I2]=B[V1I1] | [V1V2]=Z[I1I2] |