%% Time delay model for transmission line reflections %% C.R. Paul, Electromagnetics for Engineers, Ch 6 %% Ramo, Whinnery & VanDuzer, Fields and Waves in Communication Electronics %% E.W. Hansen, Engs 23 04F, 7.28.04 %% Revised 10.3.04 to allow finite rise time for input %% Time is normalized, t' = t / T, T=L/v %% Space is normalized, x' = x/L %% Line parameters are summarized by reflection coefficients at source and %% load, gS and gL. This model does not take into account the frequency response of the %% transmission line -- edge shape is preserved %% Input is either a unit step or a unit-height rectangular pulse of %% variable width. %% To explore transition to lumped behavior, let Tr->6 (Tr > 6 is lumped) %% User can change these parameters Zo = 53.5; % Characteristic impedance Rs = 50; % Source resistance RL = Inf; % Load resistance (termination) InputType = 'step'; % 'pulse' or 'step' Tr = 2; % Risetime of pulse (as a fraction of single pass delay T) Tp = 2*Tr; % Length of pulse input (as a fraction of single pass delay T) N = max(6, Tp+Tr); % Number of round trips in the simulation %%------------------------------------------------------------------------ %% Don't change anything after this unless you know what you're doing Nr = 10; % Number of samples per pulse rise (from 0 to 1). Nt = round(Nr/Tr); % Number of time samples per pass (2 passes per round trip) %% Calculate reflection and transmission coefficients if Rs == inf, gS = 1; else gS = (Rs-Zo)/(Rs+Zo); end if RL == inf, gL = 1; else gL = (RL-Zo)/(RL+Zo); end %% Inputs Vstep = ones(1,2*N*Nt); % Step input Vstep(1:Nr) = (1-cos(pi*linspace(0, 1, Nr)))/2; % Put the finite rise in (raised cosine) if strcmp(InputType, 'step')==1, % Pick an input Vs = Vstep; else shift = round(Nt*Tp); % Pulse is step - shifted step Vs = Vstep - [zeros(1, shift), Vstep(1 : end-shift)]; end %% Propagate the input down the line and back, multiple times V0 = (1-gS)/2 * Vs; % Initialize the construction VL = (1-gS)/2 * (1+gL) * [zeros(1, Nt), Vs]; % One-pass offset for n=1:N, % Construct V0 & VL by adding successive bounces x0 = (1-gS)/2 * (1+gS)*gL*(gL*gS)^(n-1) * Vs; xL = (1-gS)/2 * (1+gL) * (gL*gS)^n * Vs; % Extend the wave to make room for adding the new reflection V0 = [V0, V0(end)*ones(1, 2*n*Nt+length(x0)-length(V0))]; VL = [VL, VL(end)*ones(1, (2*n+1)*Nt+length(xL)-length(VL))]; % Add the reflection V0(2*n*Nt+1 : end) = V0(2*n*Nt+1 : end) + x0; VL((2*n+1)*Nt+1 : end) = VL((2*n+1)*Nt+1 : end) + xL; % Display the results at the end of each pass plot((0:length(V0)-1)/Nt, V0, 'r', (0:length(VL)-1)/Nt, VL, 'b',... (0:length(Vs)-1)/Nt, Vs, 'k') hold off set(gca, 'xlim', [0, (2*N+1)]) set(gca, 'ylim', [-2.1, 2.1]) set(gca, 'fontsize', 12) xlabel('t / T', 'fontsize', 14) ylabel('V(x,t) / Vo', 'fontsize', 14) legend('V(0,t)', 'V(L,t)', 'V_{in}(t)') title(['LINE REFLECTIONS: \Gamma_S=',num2str(gS),', \Gamma_L=', num2str(gL)], 'fontsize', 14) % pause(1) end