% Displaying Standing and Traveling Waves
% Fields and Waves I
% Summer 2008
% K.A. Connor

% General Wave Parameters
f=91.5e6; % FM Radio Frequency
w=2*pi*f; % Angular Frequency

% Transmission Line Properties (Low Loss Conditions)
ltl=.25e-6; % Inductance per meter
ctl=100e-12; % Capacitance per meter
rtl=0.0; % Resistance per meter (set to zero for lossless line)
d=5; % Length of line
vtl=1/sqrt(ltl*ctl); % Propagation Velocity
Zo=sqrt(ltl/ctl); % Characteristic Impedance
beta=w/vtl; % Propagation Constant
lam=2*pi/beta; % Wavelength
alf=rtl/(2*Zo); % Decay Constant
gam=alf+j*beta; % Complex Propagation Constant

% Distance Range for Plots (positive values are chosen)
z=[0:.001:1].*d; % Divides up line length in small pieces

% Load (commment out to set the value of Zl before running this)
% Zl=93; % Real load resistance

% Reflection Coefficient at the Load
Gaml=(Zl-Zo)/(Zl+Zo); % Uses the real Zo form

% Positive Traveling Wave Amplitude
Vp=10; % This specifies the magnitude of the waves

% Voltage Wave (Phasor form). Note that this sets the phase terms equal to
% zero at the load (z=d) location. 
V=Vp.*(exp(-gam.*(z-d))+Gaml.*exp(+gam.*(z-d))); % Could also be written in terms of beta and alf

% Plotting the Standing Wave Pattern
plot(z,abs(V),'o',z,-abs(V),'o');grid;title('Voltage Standing Wave');
xlabel('Meters');ylabel('Volts');
axis([0 d -2*Vp 2*Vp]); % Fixed plot axes




