python-necpp icon indicating copy to clipboard operation
python-necpp copied to clipboard

VSWR calculations gives negative values. VSWR cannot be negative.

Open mike6000 opened this issue 2 years ago • 1 comments

VSWR can go negative. The correct way to calculate VSWR is: VSWR= (1 + | Γ |)/(1 - | Γ |) In the code below, the absolute value operators are not included so the VSWR looks like can be negative. https://github.com/tmolteno/python-necpp/blob/03713c8a53e6114db5ba5a7a4e49601f213e4500/PyNEC/example/antenna_util.py

mike6000 avatar Apr 23 '22 07:04 mike6000

Looks ok to me

def reflection_coefficient(z, z0):
  return np.abs((z - z0) / (z + z0))

SimplebutComplex avatar Jun 15 '22 16:06 SimplebutComplex