Saturday, 28 September 2013

Understand Standing Waves and Transmission Lines using Matlab Codes

Matlab R2008a is The Software to be used to Run the Program

1.Program to Understand Standing waves with Different Reflection Coefficients

clc;
clear all;
close all;
% V=Voplus*cos(wt-beta*z)+Vominus*cos(wt+beta*z);
%(Vominus/voplus=Ref) 
lamda=input('Wavelength of Wave');
u=input('Velocity of wave in Medium');
Ref=input('Reflection Coefficient');
Voplus=input('Forward Travelling wave real');
f=u/lamda;%frequency of EM wave
beta=2*pi/lamda;%propagation Constant
Vominus=Voplus*Ref;  
z=-2*lamda:lamda/100:0;
figure(1);
hplot=plot(z,zeros(1,length(z)));
axis([-2*lamda 0 -2*Voplus  2*Voplus]);
grid on;
t=0;
VSWR=(1+abs(Ref))/(1-abs(Ref));
% for j=1:1000 % for Observing the Wave motion with time and Space
%         V=real(Voplus*exp(1i*(2*pi*f*t-beta*z))+Vominus*exp(1i*(2*pi*f*t+beta*z)));
%         set(hplot,'YData',V);
%         pause(0.001);
%         t=pi/(2*pi*f*20)+t;
% end;
for j=1:100 % for observing the wave Amplitute Spane in Space
        V=real(Voplus*exp(1i*(2*pi*f*t-beta*z))+Vominus*exp(1i*(2*pi*f*t+beta*z)));
        plot(z,V);
        hold on;
        pause(0.001);
        t=pi/(2*pi*f*50)+t;

end;
 Given:
Wavelength of Wav   :  3
Velocity of wave        : 12345678
Reflection Coefficient  : 0.5
Forward Travelling 
wave Magnitue            : 12











2. Program to understand Transmission lines with different loads and Transmission Parameters

clc;
clear all;
close all;
% Given Length of Transmission Line 'L', Propagation Constant 'Gamma',
% Characteristic impedance 'Zo', Input Voltage i.e Vin Cos(2*pi*ft) 'Vin', Source impedance Zs,
% Load Impedance 'ZL',Input frequency 'f'.
L = input('Length of Transmission Line ');
gamma= input('Propagation Constant');
Zo=input('Characteristic Impedance of Tx Line');
Vin=input('Input Voltage Amplitude');
Zs=input('Source impedance');
ZL=input('Load impedance');
f=input('Input Frequency');
RefL=(ZL-Zo)/(ZL+Zo);
Zin=Zo*(ZL*cosh(gamma*L)+Zo*sinh(gamma*L))/(Zo*cosh(gamma*L)+ZL*sinh(gamma*L));
Vzo=Vin*Zin/(Zin+Zs);
Izo=Vzo/Zin;
Voplus=(Vzo+Izo*Zo)/2;
Vominus=(Vzo-Izo*Zo)/2;
z=0:L/100:L;
figure(1);
hplot=plot(z,zeros(1,length(z)));
axis([0 L -2*Vin  2*Vin]);
grid on;
t=0;
VSWR=(1+abs(RefL))/(1-abs(RefL));
for j=1:10000
        I=(((Voplus*exp(-gamma*z))/Zo)-((Vominus*exp(gamma*z))/Zo))*exp(1i*2*pi*f*t);
        V=((Voplus*exp(-gamma*z))+(Vominus*exp(gamma*z)))*exp(1i*2*pi*f*t);
        set(hplot,'YData',real(V));
        pause(0.001);
        t=pi/(2*pi*f*20)+t;
end;
Given:
Length of Transmission Line:  3
Propagation Constant          :  0.2+5i
Characteristic Impedance    :  50
 of Tx Line                           
Input Voltage Amplitude      : 12
Source impedance               : 30
Load impedance                  : 100+60i
Input Frequency                   :1000000

when you run the program you can see a motion picture




3. Program to understand Transmission lines with different loads and Transmission Parameters with drawing all  possible values the voltage  can take as a function of length.


clc;

clear all;
close all;
% Given Length of Transmission Line 'L', Propagation Constant 'Gamma',
% Characteristic impedance 'Zo', Input Voltage i.e Vin Cos(2*pi*ft) 'Vin', Source impedance Zs,
% Load Impedance 'ZL',Input frequency 'f'.
L = input('Length of Transmission Line ');
gamma= input('Propagation Constant');
Zo=input('Characteristic Impedance of Tx Line');
Vin=input('Input Voltage Amplitude');
Zs=input('Source impedance');
ZL=input('Load impedance');
f=input('Input Frequency');
RefL=(ZL-Zo)/(ZL+Zo);
Zin=Zo*(ZL*cosh(gamma*L)+Zo*sinh(gamma*L))/(Zo*cosh(gamma*L)+ZL*sinh(gamma*L));
Vzo=Vin*Zin/(Zin+Zs);
Izo=Vzo/Zin;
Voplus=(Vzo+Izo*Zo)/2;
Vominus=(Vzo-Izo*Zo)/2;
z=0:L/100:L;
axis([0 L -2*Vin  2*Vin]);
grid on;
t=0;
VSWR=(1+abs(RefL))/(1-abs(RefL));
for j=1:100
        I=(((Voplus*exp(-gamma*z))/Zo)-((Vominus*exp(gamma*z))/Zo))*exp(1i*2*pi*f*t);
        V=((Voplus*exp(-gamma*z))+(Vominus*exp(gamma*z)))*exp(1i*2*pi*f*t);
        plot(z,real(V));
        hold on;
        t=pi/(2*pi*f*50)+t;
end;

Given:
Length of Transmission Line:  3
Propagation Constant          :  0.2+5i
Characteristic Impedance    :  50
 of Tx Line                           
Input Voltage Amplitude      : 12
Source impedance               : 30
Load impedance                  : 100+60i ohms
Input Frequency                   :1000000Hz







Link through which you can learn how to solve Smith Chart Problems with Online Interactive Tool:

No comments:

Post a Comment