Java Scrap Book  

Java Scrap Book > MATLAB > lossless transmission

lossless transmission

% LOSSLESS TRANSMISSION LINE
function lossless_trans
clear all;
% Initializattion of basic parameters
vp=2e6;
Zo=50;
f=1E6;
omega=2*pi*f;
beta=omega/vp;
lambda=2*pi/beta;
Vo=1;

%Vector setup for the position and time
tt=linspace(0,5/f,1000);
z=linspace(-4*lambda, 0,1000); %in this class z=0 is at the load end

%Reflection coefficient.
ZL=20;
gamma=(ZL-Zo)/(ZL+Zo);

%Voltage setup
t=tt(1); %select one value of time
V_forward=real(Vo.*exp(-j.*beta.*z).*exp(j.*omega.*t));
V_back=real(Vo.*gamma.*exp(j.*beta.*z).*exp(j.*omega.*t));
V_total=V_forward+V_back;

%Plot the voltages
subplot(2,1,1);
plot(z,V_forward,'b');
hold 'on';
plot(z,V_back,'r');
plot(z,V_total,'k');
hold 'off';
xlabel('Time(t)');
ylabel('Volatage (V)');
title('Lossless Transmission Line Analysis');

%For different values of time
for lp=1:length(tt)
t=tt(lp);
%Voltage setup
V_forward=real(Vo.*exp(-j.*beta.*z).*exp(j.*omega.*t));
V_back=real(Vo.*gamma.*exp(j.*beta.*z).*exp(j.*omega.*t));
V_total=V_forward+V_back;

%Plot the voltages
subplot(2,1,2);
plot(z,V_forward,'b');
hold 'on';
plot(z,V_back,'r');
plot(z,V_total,'c');
end

xlabel('Time(t)');
ylabel('Volatage (V)');
title('Forward(blue)/Reverse(red)/Total standing wave(yellow)');
end


Copyright © 2013-2018

javascrapbook.com is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

Contact email: help@javascrapbook.com