%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%             Thank you for using ClarkWare Products!!!!               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% VSWR Simple vswr plotter .
%      VSWR (Freq, Zl, Zo) plots the Voltage Standing Wave Ratio of the 
%      complex impedances in Zl with respect to the characteristic 
%      impedance Zo, over the frequency range in Freq. If Zl is a matrix
%      ie, the columns contain complex values, then each column will be
%      a separate curve in a different colour etc. 
%      The plot is limited at a VSWR of 3.5, as this is most common - edit
%      if necessary!
% 

%      Written by:
%      Alan Robert Clark, PrEng.
%      Dept Elec Eng
%      P.O.Wits
%      2050 South Africa
%      clark@odie.ee.wits.ac.za
%      15 December 1992

function vswr(freq,Zl,Zo);
rho=(Zl-Zo)./(Zl+Zo);
rhomag = abs(rho);
s=(1+rhomag)./(1-rhomag);
% Never normally interested in VSWR > 3.5......
axis([min(freq), max(freq), 1, 3.5]);
plot(freq, s);

