4NEC2 plots of STL VSWR

A correspondent has been tearing his hair out trying to replicate my VSWR plots of some STL.


Above is an example where the Z0 has been set to 0.0901847Ω which is the feedpoint impedance of the loop at resonance. 

The dialogue provided in 4NEC2 will not allow the user to enter less than 0.1Ω which is really limiting when working with small loops.

4NEC2 saves its settings in a file 4NEC2.ini in the exe directory, and fortunately it does not apply the same edit checks when reading that file that it does when using the dialogue. If you close 4NEC2 and edit the Z0= line to set your desired value, it will be used when 4NEC2 is opened. Yes, this means editing the file against the warnings in the file, take a backup and do it carefully.

Sure, this is not convenient, but it is functional.

Since I do this so often, I wrote a little bat file that I can drag a NEC output file onto, it will find the feed point R and edit the ini file to that value.

@echo off
if *%1==* goto usage

set REPORT=%1
if not exist %REPORT% goto notfound

set INIFILE="c:\4nec2\exe\4nec2.ini"

copy %INIFILE% 4nec2.ini

FOR /F "tokens=* USEBACKQ" %%F IN (`sed -n "/- - - ANTENNA IN/{n;n;n;n;s/^.\{60\}\(.\{12\}\).*/\1/;p;q}" %REPORT%`) DO (
SET Z0=%%F
ECHO Z0=%Z0%
sed -i "/Z0=/cZ0=%Z0%" %INIFILE%
goto cleanup

echo usage: %0 reportfile
goto end

echo File %REPORT% not found.
goto usage


It uses sed, so you will need that installed.