MATLAB: How to bisect S-parameters in an S2P file into two equal halves using RF Toolbox R2015a

RF Toolbox

I have a network, say "N", which consists of two identical, cascaded networks, say "N1" and "N2". I have an S2P file that represents S-parameters of the network "N". I would like to identify the S-parameters of each of the original sub-networks ("N1" or "N2", which are identical). How can I identify S-parameters of two identical networks in a cascaded connection from the S-parameters of the resultant network?
 

Best Answer

(1) It is important to note that there may not be a unique solution to this problem. In other words, there may exist many "N1" (or "N2") networks that are equivalent to the same original "N", when cascaded. The attached script "demo_multiple_S_param_solution.m" demonstrates this further. It shows that for a given network "N" with S-parameters [0 1;1 0], there exist two solutions [0 1;1 0] and [0 -1;-1 0] which satisfy the requirement. 
(2) Also, please keep in mind that for some edge cases, there may not exist a solution at all.
(3) Keeping both (1) and (2) in mind, if there is at least one solution, it is possible to find it. The example shown in the attached script "demo_split_S_param_cascaded.m" uses ABCD parameters to find it. For most data sets, you can convert between S and ABCD parameters using the "s2abcd" and "abcd2s" functions in the RF Toolbox. 
The ABCD parameters have a useful property: when you cascade two networks, you can discover the resulting ABCD parameters by multiplying the original ABCD parameters of the individual networks. Hence, we can find the ABCD parameters of "N1" and "N2" by taking the matrix square root of the ABCD parameters of "N".
As shown in the attached script "demo_split_S_param_cascaded.m", the general workflow is as follows: # For each frequency, convert the S-parameters of "N" to ABCD-parameters using the "s2abcd" function. # Take the square root of that matrix using the "sqrtm" function, which gives the ABCD-parameters of the "N1" network.  # Finally, convert those ABCD-parameters into S-parameters using the "abcd2s" function.