GeneralPlotting with Touchstone files

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
goltoof
Posts: 15
Joined: Wed Feb 04, 2015 8:08 pm

Plotting with Touchstone files

Post by goltoof »

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.
Attachments
s2ptest.zip
(20.68 KiB) Downloaded 250 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Plotting with Touchstone files

Post by Johannes_B »

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
goltoof
Posts: 15
Joined: Wed Feb 04, 2015 8:08 pm

Re: Plotting with Touchstone files

Post by goltoof »

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 ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Plotting with Touchstone files

Post by Johannes_B »

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.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Re: Plotting with Touchstone files

Post by torbjorn t. »

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?
torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Plotting with Touchstone files

Post by torbjorn t. »

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.
funclines3.png
funclines3.png (37.23 KiB) Viewed 5264 times

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}
Post Reply