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.