Source code of S parameter analysis group for refractive index extraction


I want to understand the meaning of the source code of S parameter analysis group shown below.
This is for extraction of effective index and impedance for metamaterials.

Analysis/Script/Low 209-211 & 212-214

 n1 = (-1i*log( x+1i*sqrt(1-x^2) ) ) / (k*d);
 n2 = (-1i*log( x-1i*sqrt(1-x^2) ) ) / (k*d);
 n = (imag(n1) >= 0)*n1 + (imag(n1) < 0)*n2;

 z1 = sqrt( ( (1+S11)^2-S21^2 ) / ( (1-S11)^2-S21^2 ) );
 z2 = -sqrt( ( (1+S11)^2-S21^2 ) / ( (1-S11)^2-S21^2 ) );
 z = (imag(z1) <= 0)*z1 + (imag(z1) > 0)*z2;

Why do we have to separately consider n1 and n2, or z1 and z2, with different symbol of “sqrt” in each equation? Why do we separately calculate “imag(n1) >= 0” and “imag(n1) <0” in the equations of n, and also z?

Thanks in advance.


Hi @natsuo,

The expressions we use for the effective index calculation in metametarials is based on these two references:

[1] D. R. Smith et al., “Electromagnetic parameter retrieval from inhomogeneous metamaterials”, Phys Rev E 71, 036617 (2005)
[2] D. R. Smith et al., “Determination of effective permittivity and permeability of metamaterials from reflection and transmission coefficients”, Phys Rev B 65, 195104 (2002)

As explained in [2], the effective index n and impedance z are complex functions with multiple branches. Therefore, to write the final expression for this quantities you need to choose the branch consistent with the expected physical properties. For example, for the effective index we assume the material is passive; therefore, the sign of the square root should be chosen so that the imag(n)>=0.

Hope this helps!


Thank you very much!


Actually I got another question.
In the reference [2], Re(z)>0 is required when materials are passive. In the script, however, it seems that Im(z)<0 is applied to calculate z. Do you know why this condition was chosen?


Hi @natsuo,

In general, there are multiple choices that you can make for the signs of the square roots and the branches you use. In the analysis group we provide, the choice was made for the structure described in Smith’s 2005 paper. In that case we used Smith’s results (see Fig. 3 in his paper) as reference, and the choice we made turned out to be appropriate. Note that in the end the results for the impedance are also consistent with the condition that Re(Z)>0:

Therefore, in this case either choice, Re(Z)>0 or Im(Z)<0, gives the same results. However, this is not always the case, so ultimately you need to check that the choice you make has physical meaning. One approach is to plot the results for the different choices of roots and branches, and then pick the appropriate ones. Note that you might have to make different choices for different frequency ranges; for example, sometimes you can see unphysical discontinuities caused by the correct choice in one region and the wrong one in the other.