如何插入 LTspice .plt 图?

如何插入 LTspice .plt 图?

我有一个 .plt 图,我想将其插入到 tex 文档中。是否有任何软件包可以实现此操作?所需的语法是什么?

答案1

在 LTspice 中,.plt文件只是格式说明符 --- 它们不包含绘制图形的实际数据。我的建议是,要获得高质量的图形,请保存数据并直接使用 生成它们pgfplots

示例:我在此处保存 V4 和 I(V1) 的数据(您可以通过选择 LTSpice 中的图形窗口来访问该对话框,然后使用File-> Export data as text);在此示例中,我将数据保存为名为的文件jfet_mixer2.txt

LTspice save

然后我使用这个代码片段:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.13}
\usetikzlibrary{arrows.meta,positioning,calc}

% Style to select only points from #1 to #2 (inclusive)
\pgfplotsset{select coords between index/.style 2 args={
    x filter/.code={
        \ifnum\coordindex<#1\def\pgfmathresult{}\fi
        \ifnum\coordindex>#2\def\pgfmathresult{}\fi
    }
}}

\begin{document}
\begin{tikzpicture}[
    ]
    \begin{axis}[
                xlabel=$t$, ylabel=$V_4$, 
                    axis y line*=left,
            ]
            \addplot[color=green,
                select coords between index={1}{400},
                filter discard warning=false, unbounded coords=discard
                ] table [x index=0, y index=1]{jfet_mixer2.txt};
    \end{axis}
    \begin{axis}[
            xlabel=$t$, ylabel=$I(V_1)$, 
                    axis y line*=right,
                    axis x line=none,
            ]
            \addplot[color=blue, 
                select coords between index={1}{400},
                filter discard warning=false, unbounded coords=discard
                ] table [x index=0, y index=2]{jfet_mixer2.txt};
    \end{axis}
\end{tikzpicture}
\end{document}

获得:

Output graph

警告:

通常,您保存的文件中有大量行,您必须修剪它们。您可以查看各种方法和建议 --- 您可以跳过数据(但注意别名!), 使用更复杂的方法,情节就像我的情况一样(参考)。

答案2

您可以在 LTspice 中以 .emf 格式保存波形图像,单击工具->将图像写入 .emf 文件,这样您就可以使用此格式的图像在线转换为 pdf,然后将 pdf 图像插入文档中。结果会令人惊讶。建议更改两个轴的字体大小,为此,工具->控制面板->波形,然后您可以更改字体类型、大小(在我的情况下,我输入了 20)和笔触宽度,大小为 2 会更好,图表上没有网格也会带来更好的可视化效果。

相关内容