I have implemented the algorithm displayed at http://qucs.sourceforge.net/tech/node5.html to convert a S matrix (as generated by an Agilent network analyer, in Touchstone format) into a Z impedance matrix (see below). However, I *suspect* that this would be much more efficient using a three-dimensional matrix instead of the "for" loop, a single command to do the actual calculation, and return a 2x2xf matrix, where "f" is the number of samples.
But I'm not sure how to do that - and how to work with a matrix like this (like matrix multiplication etc). Can anybody help out? I'm using Matlab 14.1 (SP2) under Linux (SuSE 9.1 / 9.3). I looked at various Matlab FAQs on the Web but couldn't find anything related to working with (N>2)-dimensional matrices.
% % [f, Z11,Z12,Z21,Z22] = S2P2Z(f, S11,S12,S21,S22, Z0); % % formula: Z = Gref * (E-S)^-1 * (S * Zref + Zref*) * Gref % % Z = result matrix % S = input matrix % E = identity matrix % Gref = E * 1/(2*sqrt(|Re(Z_0)|)) % Zref = E * Z_0 %
function [f, Z11,Z12,Z21,Z22] = S2P2Z(Z0, fS11,fS12,fS21,fS22)