Search This Blog

Showing posts with label computer applications. Show all posts
Showing posts with label computer applications. Show all posts

Sunday, June 29, 2014

MATLAB program for solving PI model of a transmission line from ABCD parameters

% This function obtains the pi model of a transmission line
% from the ABCD constants of the line.


function [Z, Y, ABCD] = ABCD2PI(A, B, C)
global   par1  
par1=4;
if exist('A')~=1 %#ok<*EXIST>
A = input('Enter the complex line constant A = '); else end
if exist('B')~=1
B = input('Enter the complex line constant B = '); else end
if exist('C')~=1
C = input('Enter the complex line constant C = '); else end
D = A;
Z = B; Y = 2*C/(A+1);

if imag(Y) ~= 0,
Zc = sqrt(Z/Y); %#ok<*NASGU>
else
end
ABCD = [A  B; C  D];
disp(' '),  disp(' Two port model, ABCD constants'),
disp(' ----------------------------')
disp(' ')
fprintf('         %-11.5g + j', real(A)), fprintf(' %-11.5g', imag(A))
fprintf('   %-11.5g + j', real(B)), fprintf(' %-11.5g  \n', imag(B))
fprintf(' ABCD =                                                             \n')
fprintf('         %-11.5g + j', real(C)), fprintf(' %-11.5g', imag(C))
fprintf('   %-11.5g + j', real(D)), fprintf(' %-11.5g   \n', imag(D))
fprintf(' \n Z = %g + j' ,real(Z)), fprintf(' %g ohms \n', imag(Z))
fprintf(' Y = %g + j' ,real(Y)), fprintf(' %g siemens \n', imag(Y))