I've exported some Touchstone ".s2p" files from a network analyzer. The plots saved by our analyzers are very detailed and show every little disturbance in signal. We want something more simplistic, smooth curve. Closest post I've come to for working with touchstone files is
http://tex.stackexchange.com/questions/ ... 1p-s2p-s3p
However I can't get it to work, it's an incomplete example. I need a more polished example to work with. Attached a file of one of our exports. Hoping someone else has worked with these files to create plots and can provide a good template to run with.
General ⇒ Plotting with Touchstone files
Plotting with Touchstone files
- Attachments
-
- s2ptest.zip
- (20.68 KiB) Downloaded 250 times
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: Plotting with Touchstone files
Isn't that the very same question? http://latex-community.org/forum/viewto ... 45&t=27153
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Re: Plotting with Touchstone files
Sorry, should've checked the guidelines. Figured the general thread might get more exposure. I won't cross post anymore just not entirely sure where this belongs, possibly Math & Science ?
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: Plotting with Touchstone files
No problem.
We are a bit short on helpers and supporters right now. In fact i am the only regular one, a hand full others drop in occasionally.
I pushed the question at TeX.SX back on top, maybe there will be an answer.
We are a bit short on helpers and supporters right now. In fact i am the only regular one, a hand full others drop in occasionally.
I pushed the question at TeX.SX back on top, maybe there will be an answer.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
-
- Posts: 162
- Joined: Wed Jun 17, 2009 10:18 pm
Re: Plotting with Touchstone files
goltoof, could you specify exactly how that file should be read? Is it just one column vs. another? I understand there are other forms of these files, with more complex formats, do you need to generalize to those?
-
- Posts: 162
- Joined: Wed Jun 17, 2009 10:18 pm
Plotting with Touchstone files
For example, to plot the first column versus the second and fourth columns, you can do as in the code below. The column count start at zero, hence x index=0. To plot different columns, just use different values for y index. The skip first n skips the first n lines of the file.
Code: Select all
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel={frequency [GHz]},
ylabel={S [dB]},
no markers,
thick,
legend pos=south east
]
\addplot table[mark=none, x index=0, skip first n=5, y index=1] {data.s2p};
\addlegendentry{$s_{11}$}
\addplot table[mark=none, x index=0, skip first n=5, y index=3] {data.s2p};
\addlegendentry{$s_{21}$}
\end{axis}
\end{tikzpicture}
\end{document}