% Frequency is 13.5Mhz
%minhanhnguyen@q.com
% Clear the screen
clc;
clear;
% close all windows
close all;
% use these Parameters to calculate and plot Pulse Propagation on a Transline
Ro=50; %Ro = line impedance
Rl=100; %Rl = load resistance
Rg=25; %Rg = generator resistance
Vo=10; %Vo = voltage source
T=.08; %T = pulse width
v=1; %v = wave velocity
d=1; %d = line length
dt=.02; %dt = time step,
n=170; %n = number of time steps
% Voltage Divider at Input
vDivider = (Ro/(Ro+Rg));
% Reflection Coefficient at Load
gamLoad = (Rl-Ro)/(Rl+Ro);
% Reflection Coefficient at Generator
gamGenerator = (Rg-Ro)/(Rg+Ro);
% Transit Time
tTime = d/v;
% Position along the line
x=[0:d/500:d];
for j = 0:n;
% Time
t = j*dt;
% Leading edge of pulse
xl = v*t;
% Trailing edge of pulse
xt = v*(t-T);
% Voltage along the line at time t
V = Vo*(vDivider*(x<xl).*(x>xt));
V = V + Vo*(vDivider*gamLoad)*(x>(2*d-xl)).*(x<(2*d-xt));
V = V + Vo*(vDivider*gamLoad*gamGenerator)*(x<(xl-2*d)).*(x>(xt-2*d));
V = V + Vo*(vDivider*(gamLoad^2)*gamGenerator)*(x>(4*d-xl)).*(x<(4*d-xt));
% Plotting the result
plot(x,V);axis([0 d -Vo Vo]);grid;
title('Pulse voltage vs. distance');
xlabel('Distance Along The Line');
ylabel('Pulse Voltage');
pause(.5)
end
No comments:
Post a Comment