From Y-parameters to S-parameters
In matrix form, the formula is
S=K(IN−Z0Y)(IN+Z0Y)−1K−1
When dealing with 2 ports, we obtain
S11S12S21S22=Y11Z1+Y22Z2+Y11Y22Z1Z2−Y12Y21Z1Z2+1Y22Z2−Y11Z1−Y11Y22Z1Z2+Y12Y21Z1Z2+1=−k2(Y11Z1+Y22Z2+Y11Y22Z1Z2−Y12Y21Z1Z2+1)2Y12Z1k1=−k1(Y11Z1+Y22Z2+Y11Y22Z1Z2−Y12Y21Z1Z2+1)2Y21Z2k2=Y11Z1+Y22Z2+Y11Y22Z1Z2−Y12Y21Z1Z2+1Y11Z1−Y22Z2−Y11Y22Z1Z2+Y12Y21Z1Z2+1
The formulas are obtained with the methods explained here.
The MATLAB implementation can be found in circuitconversions on Gitlab.
Definitions
II1⋮IN=YVV1⋮VN | BB1⋮BN=SAA1⋮AN |
The incident and reflected waves are defined as
A=K(V+Z0I)B=K(V−Z0I)
where K and Z0 are defined as
K=k1⋱kNZ0=Z0,1⋱Z0,N
with Z0,i the reference impedance for port i and ki defined as
ki=2ℜ(Z0,i)1ki=α2∣Z0,i∣ℜ(Z0,i)
depending on whether you are using power- or pseudowaves.