# Can port parameters in one representation (mag-angle, decibel-angle, or real-imaginary) be converted to the other?

I'm trying to figure out what network parameter data would be "best" to use when generating a Touchstone file, or if the different data representations are equivalent in terms of the information they store in which case it doesn't really matter which one I choose:

Touchstone v1 files (.s1p, .s2p) specify 3 possible network data formats:

• DB for decibel-angle, where $$\decibel = 20 × \log_{10}(magnitude) \$$
• MA for magnitude-angle
• RI for real-imaginary.

Q1. Are these data formats interchangeable in the sense that one format can be changed mathematically to equate the other?

Q2. If not, what is lost by choosing one data format over the other?

Relatedly, Touchstone files can specify what kind of network parameter data is contained in the file:

• S for Scattering parameters
• Z for Impedance parameters
• H for Hybrid-h parameters
• G for Hybrid-g parameters.

Q3. Given one kind of network parameter data (S, Z, ...), can you convert mathematically to the other?

Q4. If not, what is lost by choosing one kind of network parameter data over the other?

All of these can be converted from one to another.

## Data formats

Between dB and magnitude, a logarithmic conversion makes sense.

Between magnitude/angle and real/imaginary forms, the rectangular-polar conversions apply: real = mag * cos(angle) and imag = mag * sin(angle) in one direction; mag = sqrt(real*real + imag*imag) and angle = tanh2(imag, real) in the other.

If you're working with fixed-precision data you may have some numerical precision issues; e.g. for small parameters where the angle is important, magnitude-angle format will be a better representation than a real-imag format if they get rounded off. Likewise, for very small magnitudes dB may be more useful than directly representing the magnitude.

More importantly, some of these formats are more intuitive for humans trying to understand them. For example, knowing the angle easily tells one if the network is reactive or resistive, what its phase shift is, etc. dB parameters are visually very easy to read for very small and large magnitudes.

## Types of network parameters

They can be freely interconverted. Wikipedia gives formulae, which are too long to reasonably reproduce here.

The reasoning behind why one or another format again comes down to numerical precision and interpretation. S-parameters are very useful for someone trying to make sense of the relative powers flowing through a network. Y-parameters are useful for someone who wishes to understand how two networks connected in parallel behave. etc.

• 10log10(mag) makes sense to me too, but according to this doc on page 6 it is 20log10(mag): ibis.org/touchstone_ver2.0/touchstone_ver2_0.pdf . Maybe thats a doc error, but I hope not because that would be a nasty documentation bug. Commented Oct 8, 2021 at 21:32
• You mentioned numerical precision. Is one format more precise than another? My output will be a long floating point value and its not intended to be human readable, but rather, to be imported by circuit simulation software. Commented Oct 8, 2021 at 21:33
• @KJ7LNW I would check carefully against the software implementation (e.g. by asking it to interconvert if possible, or asking it to output the same measurement in multiple formats). It may use 20*log10 internally, in spite of the logic behind 10*log10 for s-params. Commented Oct 8, 2021 at 21:34
• @KJ7LNW No format is "more precise" in all cases, since the different representations cover the same 2D space in different ways (mapped nonlinearly to each other). In most cases, if you're using a reasonable floating point format you should be good in non-esoteric cases. Commented Oct 8, 2021 at 21:36
• S-parameters are voltage ratios, hence it should be $20log_{10}(x)$ and not $10log_{10}(x)$. Commented Mar 14, 2022 at 2:52