Plot Impedance from Touchstone Files

44 views (last 30 days)
Hello Guys,
I have been using RF Toolbox quite extensively for my Signal Integrity work. I can import touchstone file, and use 'frplot' function to plot all kinds of SI data (like S11, S22 etc). However, I am not able to plot Impedance graph from touchstone file (.s2p or .s4p or .s8p). Is there a way this can be achieved? Is there a pre-defined function that can be used to plot impedance?
Note: I am currently using MATLAB 2018a version.
Thank you for your help.
  1 Comment
Srikanth K
Srikanth K on 3 Feb 2021
Convert your S-parm file to Z-parm and plot impedance plots..you can use below fucntion to do that.
Z = zparameters('defaultbandpass.s2p');
z11 = rfparam(Z,1,1);
plot(Z.Frequencies, imag(z11)) ;% this is for imaginary part of Z-, change as per your requrements
look below link for more info..
https://www.mathworks.com/help/rf/ref/zparameters.html

Sign in to comment.

Accepted Answer

Ajeya Gupta
Ajeya Gupta on 4 Feb 2021
Thanks for your reply, Srikanth. How will the characteristic impedance come into play here? I have a 50 ohms line, and I'd like to plot a TDR graph corresponding to the touchstone file. Moreover, the function 'zparameters' does not give result in time domain (the very definition of TDR plot). Instead the parameters are still in frequency domain!

More Answers (1)

Srikanth K
Srikanth K on 8 Feb 2021
Unfortunatly ,I guess we dont have a direct TDR fucntion but we can make one by writing our own function.
Please find the below link for your refeance.
the above link provides TDR response Time Vs Voltage.You can plot in Impedance vs Time using below script(for referance).
filename = 's_parm.s2p';
S_parm_cb = sparameters(filename);
s11 = rfparam(S_parm_cb,1,1);
freq = S_parm_cb.Frequencies;
Vin = 1;
tdrfreqdata = Vin*(s11+1)/2;
tdrfit = rationalfit(freq,tdrfreqdata,'NPoles',350);
Ts = 5e-12;%
N = 10000; % Number of samples
Trise = 5e-11; % Define a step signal
[Vtdr,tdrT] = stepresp(tdrfit,Ts,N,Trise);
ylabel('Differential TDR (V)');
xlabel('Time (ns)');
legend('Calculated TDR');
ylim([0.46 0.55]);
t11_row=(((2*Vtdr)-Vin)/Vin);
tdrz=50*((1+t11_row)./(1-t11_row));
figure
plot(tdrT*1e9,tdrz,'b','LineWidth',2);
ylabel('TDR (Ohm)');
xlabel('Time (ns)');
legend('Calculated TDR');
ylim([40 60]);
  2 Comments
Ajeya Gupta
Ajeya Gupta on 10 Feb 2021
Edited: Ajeya Gupta on 11 Feb 2021
Thanks for sharing this, Srikanth. This is very helpful. I also read the paper in the reference section (https://apps.dtic.mil/dtic/tr/fulltext/u2/a168194.pdf) which has a lot of details related to this implementation.
I did a lot proof reading of this code. One thing that I'v realized is the graph will be plotted only up to Ts*N time value (this product is important to view the data appropriately, since we want the x axis to scale according to the length of DUT. Essentially, the product N*Ts shoud be equal to the product of DUT_Length/Vp (Vp = signal velocity on Copper/Al).
However, one thing that I've realized is that the time where the DUT impedance ends and 50ohms termination starts is always double the electrical length of the DUT. For example, a 1 mtr cable with Vp of 0.77*c should have varying impedance up to 4.22ns. However, the TDR plot from the above code gives an impression that the DUT is 2 meters long (or the DUT impedance ends at ~8.5ns which is approximately double of 4.22ns). I am wondering why does it show like this? I can imagine someone might say that signal travels from Port 1 to Port 2 and back from Port 2 to Port 1, but in that case, I should see an impedance plot and a reverse impedance plot (to show T11 and T22). More than this, I was wondering is there is a rationale in the code behind this, or may be a way to rectify this.
Thank you.
Simon
Simon on 29 Mar 2022
Thank you for your answer, Srikanth and Ajeya Gupta. It is really helpful! But I don't understand how “tdrfreqdata = Vin*(s11+1)/2” and "t11_row=(((2*Vtdr)-Vin)/Vin)" come from. Can you explain it for me? Thank you very much.
My email:919736488@qq.com

Sign in to comment.

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!