take in s-parameter file and plot tdr impedance in matlab

To take in an S-parameter file and plot TDR (time-domain reflectometry) impedance in Matlab, follow the steps below:

  1. Load the S-parameter file using the sparameters function:
main.m
s_params = sparameters('path_to_file.s2p');
44 chars
2 lines
  1. Extract the reflection coefficient data from the S-parameters:
main.m
[frequency, s11] = s2rfreq(s_params.Parameters);
49 chars
2 lines
  1. Convert S11 to Z0 and impedance using TDR theory using the tline function:
main.m
Z0 = 50; % characteristic impedance of the transmission line in ohms
t = linspace(0,2/(max(frequency)*1e9),101);
z = tline(Z0, squeeze(s11), t, Z0);
Z = z.Z;
158 chars
5 lines
  1. Plot the TDR impedance vs. time:
main.m
plot(t*1e9, real(Z));
xlabel('Time (ns)');
ylabel('Impedance (\Omega)');
73 chars
4 lines

This code will produce a plot of the TDR impedance vs time in units of ohms and nanoseconds.

gistlibby LogSnag