folks
I've been lately struggling with modelling a transmission line. What I would like to do is to take a signal on one side of a cable, pass it through the cable and look how it has changed on the output.
My initial thought was to numerically solve the telegrapher's equation but as I suck at computational physics I dug around some more and found that there is a way to compute the influence of transmission line by the means of transfer function.
The transfer function I found on wikipedia as well as in sources cited by wikipedia is
$H(ω)= \frac{Z_LZ_C}{Z_C(Z_L+Z_S)\mathrm{cosh}(γx)+(Z_LZ_S+Z_C^2)\mathrm{sinh}(γx)}$
Here $Z_L$ is the load impedance, $Z_S$ is the source impedance and $Z_C$ is the characteristic impedance.
$γ=\sqrt{(R+jωL)(G+jωC)}$
$Z_C=\sqrt{\frac{R+jωL}{G+jωC}}$
You can see the modelled situation in the first picture.
What I did in my code was load the signal, compute the spectrum via scipy fft, used the frequency range to calculate the transfer function and multiplied the spectrum with it to compute the new spectrum after the transfer and preformed an inverse fft. The result is weird. With a cable of lenght 1 meter the amplitude drop is too big. The parameteres I used should be those of a coaxial cable RG-58, that is
R = 50 $\Omega$/meter
L = 25 nH/meter
C = 100 pF/meter
G = 0.02 S/meter
x = 1 meter
signal_hat = sfft.fft(signal)
freq = sfft.fftfreq(len(signal), (time[1]-time[0]))
gamma = np.sqrt((R+1j*freq*L)*(G+1j*freq*C))
Z_c = np.sqrt((R + 1j * freq * L) / (G + 1j * freq * C))
Z_L = Z_c
Z_s = Z_c
signal_hat_new = signal_hat*(Z_L*Z_c)/(Z_c*(Z_L+Z_s)*np.cosh(gamma*x) + (Z_L*Z_s + Z_c**2)*np.sinh(gamma*x))
signal_new = sfft.ifft(signal_hat_new)
Excuse my terrible formatting. I don't yet know how to post code properly in the comment. $\endgroup$