python-necpp
python-necpp copied to clipboard
VSWR calculations gives negative values. VSWR cannot be negative.
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
Looks ok to me
def reflection_coefficient(z, z0):
return np.abs((z - z0) / (z + z0))