Search This Blog

Showing posts with label matlab program for solving. Show all posts
Showing posts with label matlab program for solving. Show all posts

Sunday, June 29, 2014

Matlab code for finding the R, L, and C in per unit length from the ABCD constants of a transmission line.

% This function computes the r, L, and C in per unit length from the ABCD
% constants of a transmission line.

function [r, L, C, f] = ABCD2RLC(ABCD)
global     linelngt freq
if exist('ABCD')~=1 %#ok<*EXIST>
A = input('Enter the complex line constant A = ');
B = input('Enter the complex line constant B = ');
C = input('Enter the complex line constant C = ');
D = A;
ABCD = [A  B; C  D];
else
end
Length = input('Enter line length = '); linelngt= Length;
f = input('Enter line frequency = ');
freq=f;
w= 2*pi*f;
Zc = sqrt(ABCD(1,2)/ABCD(2,1));
Gama = asinh(ABCD(1,2)/Zc)/Length;
z = Zc*Gama;
y = z/Zc^2;
r = real(z);
L = imag(z)/w*1000;
C = imag(y)/w*1000000;