I have been running some Ansoft HFSS simulations of infinite arrays of antennas, recently.  A peculiar thing I noticed is that some of the impedance data, which is calculated from the S-parameter matrices, had sizable spikes (upwards of 300Ohms) inside a frequency band that, from the S-parameters, looked smooth and well matched.  Clearly something was wrong.  A low VSWR and S11 imply impedance levels close to the source impedance, yet these spikes in the impedance were there.

So I decided that, being able to compute all the data I need from S-parameters alone (as HFSS does), I exported the entire S-matrix to MATLAB and took a look at the impedance values I calculated.

HFSS gives the equation for finding the Z matrix as :

Z = sqrt(Zo*I)*inv(I-S)*(I+S)*sqrt(Zo*I)

where I=identity matrix, and S is the full S-parameter matrix

from this I plotted the exact same thing HFSS was giving for the impedances.  So I started plotting different chunks of the equation (e.g. inv(I-s) alone, (I+S) alone…) and found that the inv(I-S) term was spiking at the exact places my impedance was spiking, while the other terms were well-behaved.  Well, looks like that inversion is messing things up…indicating a singular, or more correctly a nearly-singular matrix (singular matrices have NO inverse defined).  Sure enough, using the function:

cond()

in MATLAB revealed huge condition numbers for the matrix (I-S) where the impedance spikes occurred, 2 orders of magnitude larger than the condition numbers calculated over the rest of the frequency sweep.  So I need to invert a matrix that is nearly-singular….now what??  I need single-value-decomposition (SVD) to take out those values that make the matrix singular and do a quasi-inversion, basically approximate the inversion.  MATLAB includes just such a function:

pinv() — where it’s use is  pinv(matrix, tolerance)

The tolerance can be set to an arbitrary value.  For my purposes, I can stand to lose some accuracy, so I chose a relatively large tolerance (around 0.02 or so) to take out those spikes but preserve the overal shape of the impedance waveforms.  Usually you will want to keep this very small to keep the inversion close to the true value.  But this solves my problem.

But it leads to another conclusion — HFSS, apparently, doesn’t test if its S-parameter matrices are nearly-singular (or at least I haven’t seen a way to have it do so).  Certainly it is using all sorts of inversion approximations in the solver the software uses (you can even do iterative matrix solutions in v11 of HFSS…), I don’t think it is likely that they have skimped on such checking on the data output front end.   Please post comments if you konw of any solutions in HFSS for this.