![具有可配置轴限值的 Bode 网格模板](https://linux22.com/image/462756/%E5%85%B7%E6%9C%89%E5%8F%AF%E9%85%8D%E7%BD%AE%E8%BD%B4%E9%99%90%E5%80%BC%E7%9A%84%20Bode%20%E7%BD%91%E6%A0%BC%E6%A8%A1%E6%9D%BF.png)
我正在使用来自的 bodegraph 包https://ctan.org/pkg/bodegraph目的是制作一张漂亮的 A4 纸,提供具有幅度和相位特定限制的波特网格。
通过该网站上另一个问题的提示(在 MWE 中引用),我得到了一个让我基本满意的页面。
问题是,我希望能够批量生成具有不同轴限制的多个网格页面。
在提供的 MWE 中,我使用从 -80dB 到 +20dB 的 y 轴来绘制幅度图。我认为制作另一页 y 轴范围从 -60dB 到 +40dB 的页面很容易(分区数相同,纸张大小相同,只是轴的端点不同)。
事实证明,这并不容易,因为它会移动整个网格。不幸的是,我不明白代码的确切行为,而且该包的大部分文档都是法语的……
% needs -shell-escape
% needs gnuplot installed for this to work.
% uses https://ctan.org/pkg/bodegraph
% alternatively use of https://github.com/rlkamalapurkar/bodegraph for asymptotic lines
\documentclass[a4paper]{article}
\usepackage[margin=0pt]{geometry}
\usepackage{bodegraph}
\usepackage{tikz}
\usetikzlibrary{positioning}
\pagestyle{empty} %no page numbering in footer
\begin{document}
% the scaling was taken from
% https://tex.stackexchange.com/questions/410128/how-does-xscale-yscale-work-in-tikz
% The default unit vectors in TikZ are 1cm long, so 7 units is 7cm.
% bodegraph has as default 1 unit between the major gridlines on the x-axis (each order of magnitude).
% if diagram covers 5 orders of magnitude, ->1/5
\pgfmathsetmacro{\textwidthScaleFactor}{0.85\textwidth*2.54/72.27}
\vspace*{0.5cm} %keep some space for the label
\begin{tikzpicture}[
gnuplot def/.append style={prefix={}},
xscale=1/8*\textwidthScaleFactor,
]
%Mag
\begin{scope}[yscale=12/100]
\coordinate[label=center:\bf{Angular Frequency $\omega$}] (A) at (3,-88);
\coordinate[label=left:\bf{Magnitude in $\mathbf{\left[dB\right]}$}] (B) at (0,25);
\OrdBode{10} % y axis step
\semilog{-1}{7}{-80}{20} % {décade mini}{décade maxi}{ymini}{ymaxi}
\end{scope}
%Phase
\begin{scope}[yshift = -15.5cm, yscale=12/270]
\coordinate[label=left:\bf{Angular Frequency $\omega$}] (C) at (3.7,-88-110);
\coordinate[label=left:\bf{Phase in $\mathbf{\left[^{\circ}\right]}$}] (D) at (-0.5,105);
\OrdBode{15}
\semilog{-1}{7}{-180}{90}
\end{scope}
\end{tikzpicture}
\end{document}