I am trying to write code for a transmission line problem to plot the net voltage as a function of time. I have analyzed a pattern for the net voltage at the load as shown below. The goal is to write summation code in Matlab and superimpose the voltages on a graph. The variables used are as follows:
V=amplitude of the voltage
t=time the pulse travels
tf=time the pulse reaches the end of the line
gammaL=propagation constant from the load
gammaG=propagation constant from the generator
V= 0, 0<t<tf
= v0+v0*gammaL, tf<t<3*tf
= v0+v0*gammaL+v0*gammaL*gammaG+v0*gammaL^2*gammaG, 3*tf<t<5*tf
= v0+v0*gammaL+v0*gammaL*gammaG+v0*gammaL^2*gammaG+ v0*gammaL^2*gammaG ^2 + v0*gammaL^3*gammaG ^2, 5*tf<t<7*tf
I have written some general pseudocode for the summation, but have not figured out how to perfect it and plot it as a step function. The pseudocode is as follows:
% the length of the pulse is 10ms
tf=2/3e6;
gammaL=1;
gammaG=1/3;
Rs=100;
R0=50;
v0=1;
vinitial=0;
n=15;
temp1=1;
temp2=1;
volt(1)=0;
volt(2)=v0+v0*gammaL;
for k=3:n
volt(k)=volt(2)+v0*gammaL^temp1+v0*gammaG^temp2;
if temp1=temp2
temp1=temp1+1;
else
temp2=temp2+1;
end
end
%If anyone could help with developing code for the summation and plotting it, I would be very greatful. I appreciate your help with this for I am not too familiar with Matlab programming.
