clear;
clc;

% Transmission line wave parameters: Z0 and Gamma and speed

R  = 5/1000;      % Ohm/m
L  = 2e-3/1000;   % H/m
G  = 0.5e-6/1000; % S/m
C  = 6e-9/1000;   % F/m

f  = [0:1:10000];
w  = 2*pi*f;

Z0 = sqrt( (R + j*w*L) ./ (G + j*w*C) );
G  = sqrt( (R + j*w*L) .* (G + j*w*C) );

figure(1), subplot(2,1,1), semilogx(f,abs(Z0)); xlabel('f [Hz]'); ylabel('|Z| [\Omega]');
figure(1), subplot(2,1,2), semilogx(f,phase(Z0)*180/pi); xlabel('f [Hz]'); ylabel('arc\{Z\} [deg]');

figure(2), subplot(2,1,1), semilogx(f,real(G)); xlabel('f [Hz]'); ylabel('Re\{\gamma\} [1/m]');
figure(2), subplot(2,1,2), semilogx(f,imag(G)); xlabel('f [Hz]'); ylabel('Im\{\gamma\} [1/m]');

figure(3), semilogx(f,w./imag(G)); xlabel('f [Hz]'); ylabel('v [m/s]');