texlive[71000] Master/texmf-dist: bodeplot (19apr24)
commits+karl at tug.org
commits+karl at tug.org
Fri Apr 19 23:07:11 CEST 2024
Revision: 71000
https://tug.org/svn/texlive?view=revision&revision=71000
Author: karl
Date: 2024-04-19 23:07:11 +0200 (Fri, 19 Apr 2024)
Log Message:
-----------
bodeplot (19apr24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/bodeplot/README.md
trunk/Master/texmf-dist/doc/latex/bodeplot/bodeplot.pdf
trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx
trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.ins
trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
Added Paths:
-----------
trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot-2024-02-06.sty
Modified: trunk/Master/texmf-dist/doc/latex/bodeplot/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bodeplot/README.md 2024-04-19 16:27:56 UTC (rev 70999)
+++ trunk/Master/texmf-dist/doc/latex/bodeplot/README.md 2024-04-19 21:07:11 UTC (rev 71000)
@@ -7,8 +7,9 @@
License: [LPPL-1.3c](https://github.com/rlkamalapurkar/bodeplot/blob/main/LICENSE)
## Limitations
- 1. TF commands are wrapped between -180 and 180 degrees in `pgf` mode.
- 2. Version 1.0.8 and newer store `gnuplot` temporary files in the working directory. Use class option `declutter` to restore pre-v1.0.8 behavior. Option `declutter` can cause errors if used with a `tikzexternalize` prefix.
+ 1 Before version 1.2, in `pgf` mode, the package set `trig format plots` to `rad` globally. Version 1.2 onwards, this option is passed to each `addplot` command individually so it does not affect non-`bodeplot` plots. To roll back to pre-v1.2 behavior, load the package with `\usepackage[pgf]{bodeplot}[=2024-02-06]`.
+ 2. TF commands are wrapped between -180 and 180 degrees in `pgf` mode.
+ 3. Version 1.0.8 and newer store `gnuplot` temporary files in the working directory. Use class option `declutter` to restore pre-v1.0.8 behavior. Option `declutter` can cause errors if used with a `tikzexternalize` prefix.
## Compilation instructions
1) `latex bodeplot.ins` to generate `bodeplot.sty`
Modified: trunk/Master/texmf-dist/doc/latex/bodeplot/bodeplot.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx 2024-04-19 16:27:56 UTC (rev 70999)
+++ trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.dtx 2024-04-19 21:07:11 UTC (rev 71000)
@@ -16,8 +16,10 @@
% \fi
%
% \iffalse
-%<package>\NeedsTeXFormat{LaTeX2e}[2006/05/20]
-%<package>\ProvidesPackage{bodeplot}
+%<package>\NeedsTeXFormat{LaTeX2e}[2018/04/01]
+%<package>\DeclareRelease{}{2024-02-06}{bodeplot-2024-02-06.sty}
+%<package>\DeclareCurrentRelease{}{2024/04/18}
+%<package>\ProvidesPackage{bodeplot}[2024/04/18 v1.2 Generate Bode, Nichols, and Nyquist plots]
%<package>\RequirePackage{pdftexcmds}
%<package>\RequirePackage{ifplatform}
%<package>\RequirePackage{xparse}
@@ -69,7 +71,7 @@
%</driver>
% \fi
%
-% \CheckSum{1858}
+% \CheckSum{1857}
%
% \changes{v1.0}{2021/10/25}{Initial release}
% \changes{v1.0.4}{2021/11/05}{Fixed unintended optional argument macro expansion}
@@ -80,11 +82,12 @@
% \changes{v1.1.0}{2022/07/06}{Fixed phase wrapping in gnuplot mode}
% \changes{v1.1.1}{2022/07/31}{Enable Hz and rad units}
% \changes{v1.1.7}{2024/02/06}{Detect and turn off shorthands to improve `babel' compatibility}
+% \changes{v1.2}{2024/04/18}{Removed global option to process pgf commands in radians}
%
% \GetFileInfo{bodeplot.sty}
% \DoNotIndex{\newcommand,\xdef,\gdef,\def,\edef,\addplot,\approx,\arabic,\opt,\typ,\obj,\else,\if at pgfarg,\if at Hzarg,\if at radarg,\if at declutterarg,\if at babel,\fi,\begin,\end,\feature,\footnotesize,\draw,\detokenize,\DeclareOption,\foreach,\ifdim,\ifodd,\Im,\Re,\let,\newif,\nextgroupplot,\noexpand,\expandafter,\unexpanded,\PackageError,\PackageWarning,\relax,\RequirePackage,\tikzset,\pgfmathsetmacro,\pgfmathtruncatemacro,\ProcessOptions}
%
-% \title{The \textsf{bodeplot} package\\version 1.1.7}
+% \title{The \textsf{bodeplot} package\\version 1.2}
% \author{Rushikesh Kamalapurkar \\ \texttt{rlkamalapurkar at gmail.com}}
%
% \maketitle
@@ -105,6 +108,7 @@
% Since version 1.0.8, the |bodeplot| package places all |gnuplot| temporary files in the working directory. The package option |declutter| restores the original behavior where the temporary files are placed in a folder called |gnuplot|.
% \subsection{Limitations}
% \begin{itemize}
+% \item Before version 1.2, in |pgf| mode, the package set |trig format plots| to |rad| globally. Version 1.2 onwards, this option is passed to each |addplot| command individually so that it does not affect other plots in the document. To roll back to the pre-1.2 behavior, load the package with |\usepackage[pgf]{bodeplot}[=2024-02-06]|.
% \item In |pgf| mode, Bode phase plots and Nichols charts in TF form wrap angles so that they are always between -180 and 180$^\circ$ or $-\pi$ and $-\pi$ radian. As such, these plots will show phase wrapping discontinuities. Since v1.1.1, in |gnuplot| mode, the package uses the |smooth unwrap| filter to correct wrapping discontinuities. As of now, I have not found a way to do this in |pgf| mode, any merge requests or ideas you may have are welcome! Since v1.1.4, you can redefine the |n at mod| macro using the commands |\makeatletter\renewcommand{\n at mod}{\n at mod@p}\makeatother| to wrap the phase between 0 and 360$^\circ$ or $0$ and $2\pi$ radian. The commands |\makeatletter\renewcommand{\n at mod}{\n at mod@n}\makeatother| will wrap the phase between -360 and 0$^\circ$ or $-2\pi$ and $0$ radian.
% \item Use of the |declutter| option with other directory management tools such as a |tikzexternalize| prefix is not recommended.
% \end{itemize}
@@ -602,7 +606,7 @@
% \DescribeMacro{\addBodeComponentPlot}
% |\addBodeComponentPlot|\oarg{plot-options}\marg{plot-command}
%
-% \noindent Generates a single parametric function corresponding to the mandatory argument |plot-command| and passes it to the |\addplot| macro. The plot command can be any parametric function that uses |t| as the independent variable. The parametric function must be |gnuplot| compatible (or |pgfplots| compatible if the package is loaded using the |pgf| option). The intended use of this macro is to plot the parametric functions generated using the basic component macros described in Section \ref{sec:BasicComponents} below.
+% \noindent Generates a single parametric function corresponding to the mandatory argument |plot-command| and passes it to the |\addplot| macro. The plot command can be any parametric function that uses |t| as the independent variable. The parametric function must be |gnuplot| compatible (or |pgfplots| compatible if the package is loaded using the |pgf| option, \textbf{with angles passed to trigonometric functions in radian}). The intended use of this macro is to plot the parametric functions generated using the basic component macros described in Section \ref{sec:BasicComponents} below.
%
% \subsubsection{Basic components up to first order\label{sec:BasicComponents}}
%
@@ -839,6 +843,7 @@
% \changes{v1.0.3}{2021/11/03}{Added jobname to gnuplot prefix}
% \changes{v1.0.8}{2022/07/06}{Fixed issue \#6}
% \changes{v1.1.4}{2023/10/12}{Changed phase wrapping in pgf mode}
+% \changes{v1.2}{2024/04/18}{Removed global option to process pgf commands in radians}
% We start by processing the class options.
% \begin{macrocode}
\newif\if at pgfarg\@pgfargfalse
@@ -866,9 +871,6 @@
\newcommand{\n at mod@n}[2]{(#1)-((floor((#1)/(#2))+1)*(#2))}
\if at pgfarg
\newcommand{\n at pow}[2]{(#1)^(#2)}
- \pgfplotsset{
- trig format plots=rad
- }
\else
\newcommand{\n at pow}[2]{(#1)**(#2)}
% \end{macrocode}
@@ -1295,7 +1297,7 @@
\edef\temp at mag@cmd{\noexpand\nextgroupplot [ylabel={Gain (dB)}, xmajorticks=false, \optmag at axes]
\noexpand\addplot [freq at filter, variable=t, thick, \optmag at plot]}
\edef\temp at ph@cmd{\noexpand\nextgroupplot [ph at y@label, freq at label, \optph at axes]
- \noexpand\addplot [freq at filter, variable=t, thick, \optph at plot]}
+ \noexpand\addplot [freq at filter, variable=t, thick, trig format plots=rad, \optph at plot]}
\if at pgfarg
\temp at mag@cmd {\func at mag};
\optmag at commands
@@ -1375,7 +1377,7 @@
\edef\temp at mag@cmd{\noexpand\nextgroupplot [ylabel={Gain (dB)}, xmajorticks=false, \optmag at axes]
\noexpand\addplot [freq at filter, variable=t, thick, \optmag at plot]}
\edef\temp at ph@cmd{\noexpand\nextgroupplot [ph at y@label, freq at label, \optph at axes]
- \noexpand\addplot [freq at filter, variable=t, thick, \optph at plot]}
+ \noexpand\addplot [freq at filter, variable=t, thick, trig format plots=rad, \optph at plot]}
\if at pgfarg
\temp at mag@cmd {\func at mag};
\optmag at commands
@@ -1441,7 +1443,7 @@
\build at ZPK@plot{\plot at macro}{\temp at macro}{\approx}{#3}
\fi
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, thick, \opt]}
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, thick, trig format plots=rad, \opt]}
\temp at cmd {\plot at macro};
\else
\stepcounter{gnuplot at id}
@@ -1474,7 +1476,7 @@
\fi
\if at pgfarg
\ifnum\pdf at strcmp{#2}{phase}=0
- \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd {\n at mod{\plot at macro}{2*pi}};
\else
\edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
@@ -1510,11 +1512,11 @@
% \end{macrocode}
%\end{macro}
% \begin{macro}{\addBodeComponentPlot}
-% This macro is designed to issue a single |\addplot| macro capable of plotting linear combinations of the basic components described in Section \ref{sec:BasicComponents}. The only work to do here is to handle the |pgf| package option.\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.3}{2022/11/02}{Changed implementation to respect user-supplied domain}
+% This macro is designed to create a single |\addplot| macro capable of plotting linear combinations of the basic components described in Section \ref{sec:BasicComponents}. The only work to do here is to handle the |pgf| package option.\changes{v1.1.1}{2022/07/31}{Enabled `Hz' and `rad' units for frequency and phase, respectively}\changes{v1.1.3}{2022/11/02}{Changed implementation to respect user-supplied domain}
% \begin{macrocode}
\newcommand{\addBodeComponentPlot}[2][thick]{
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd {#2};
\else
\stepcounter{gnuplot at id}
@@ -1884,7 +1886,7 @@
]}
\temp at cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
- \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \unexpanded\expandafter{\opt at plot}]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \unexpanded\expandafter{\opt at plot}]}
\if at pgfarg
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
@@ -1939,7 +1941,7 @@
]}
\temp at cmd
\addplot [only marks, mark=+, thick, red] (-1 , 0);
- \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \unexpanded\expandafter{\opt at plot}]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \unexpanded\expandafter{\opt at plot}]}
\if at pgfarg
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
@@ -1981,7 +1983,7 @@
\gdef\func at ph{}
\build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
\else
@@ -2003,7 +2005,7 @@
\gdef\func at ph{}
\build at TF@plot{\func at mag}{\func at ph}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
\else
@@ -2107,7 +2109,7 @@
\unexpanded\expandafter{\opt at axes}
]}
\temp at cmd
- \edef\temp at cmd{\noexpand\addplot [variable=t,thick,\opt at plot]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \opt at plot]}
\if at pgfarg
\temp at cmd ( {\func at ph} , {\func at mag} );
\opt at commands
@@ -2159,7 +2161,7 @@
\unexpanded\expandafter{\opt at axes}
]}
\temp at cmd
- \edef\temp at cmd{\noexpand\addplot [variable=t,thick, \opt at plot]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \opt at plot]}
\if at pgfarg
\temp at cmd ( {\n at mod{\func at ph}{2*pi*\ph at scale}} , {\func at mag} );
\opt at commands
@@ -2220,7 +2222,7 @@
\gdef\func at ph{}
\build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\func at ph} , {\func at mag} );
\else
\stepcounter{gnuplot at id}
@@ -2242,7 +2244,7 @@
\gdef\func at ph{}
\build at TF@plot{\func at mag}{\func at ph}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\n at mod{\func at ph}{2*pi*\ph at scale}} , {\func at mag} );
\else
\stepcounter{gnuplot at id}
Modified: trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.ins 2024-04-19 16:27:56 UTC (rev 70999)
+++ trunk/Master/texmf-dist/source/latex/bodeplot/bodeplot.ins 2024-04-19 21:07:11 UTC (rev 71000)
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2021 by Rushikesh Kamalapurkar
+%% Copyright (C) 2021-2024 by Rushikesh Kamalapurkar
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -16,7 +16,7 @@
\usedir{tex/latex/bodeplot}
\preamble
This is a generated file.
-Copyright (C) 2021 by Rushikesh Kamalapurkar
+Copyright (C) 2021-2024 by Rushikesh Kamalapurkar
This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3c of this license or (at your option) any later
Added: trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot-2024-02-06.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot-2024-02-06.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot-2024-02-06.sty 2024-04-19 21:07:11 UTC (rev 71000)
@@ -0,0 +1,1112 @@
+%%
+%% This is file `bodeplot.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bodeplot.dtx (with options: `package')
+%% This is a generated file.
+%% Copyright (C) 2021 by Rushikesh Kamalapurkar
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in:
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX version 2006/05/20 or later.
+\NeedsTeXFormat{LaTeX2e}[2006/05/20]
+\ProvidesPackage{bodeplot}
+\RequirePackage{pdftexcmds}
+\RequirePackage{ifplatform}
+\RequirePackage{xparse}
+\RequirePackage{pgfplots}
+ \pgfplotsset{compat=1.18}
+ \usepgfplotslibrary{groupplots}
+
+\newif\if at pgfarg\@pgfargfalse
+\DeclareOption{pgf}{
+ \@pgfargtrue
+}
+\newif\if at declutterarg\@declutterargfalse
+\DeclareOption{declutter}{
+ \@declutterargtrue
+}
+\newif\if at radarg\@radargfalse
+\DeclareOption{rad}{
+ \@radargtrue
+}
+\newif\if at hzarg\@hzargfalse
+\DeclareOption{Hz}{
+ \@hzargtrue
+}
+\ProcessOptions\relax
+\newcommand{\n at mod}[2]{(#1)-((round((#1)/(#2)))*(#2))}
+\newcommand{\n at mod@p}[2]{(#1)-((floor((#1)/(#2)))*(#2))}
+\newcommand{\n at mod@n}[2]{(#1)-((floor((#1)/(#2))+1)*(#2))}
+\if at pgfarg
+ \newcommand{\n at pow}[2]{(#1)^(#2)}
+ \pgfplotsset{
+ trig format plots=rad
+ }
+\else
+ \newcommand{\n at pow}[2]{(#1)**(#2)}
+ \newcounter{gnuplot at id}
+ \setcounter{gnuplot at id}{0}
+ \if at declutterarg
+ \edef\bodeplot at prefix{gnuplot/\jobname}
+ \else
+ \edef\bodeplot at prefix{\jobname}
+ \fi
+ \tikzset{
+ gnuplot at prefix/.style={
+ id=\arabic{gnuplot at id},
+ prefix=\bodeplot at prefix
+ }
+ }
+ \ifwindows\else
+ \if at declutterarg
+ \immediate\write18{mkdir -p gnuplot}
+ \fi
+ \fi
+\fi
+\newif\if at babel\@babelfalse
+\AtBeginDocument{%
+ \@ifpackageloaded{babel}{%
+ \@babeltrue
+ \let\shorthand at list\@empty
+ \def\do#1{%
+ \begingroup
+ \lccode`\~=`#1\relax
+ \lowercase{\ifbabelshorthand~{\g at addto@macro\shorthand at list{~}}{}}
+ \endgroup
+ }
+ \dospecials
+ }{}
+}
+\pgfplotsset{
+ bode at style/.style = {
+ label style={font=\footnotesize},
+ tick label style={font=\footnotesize},
+ grid=both,
+ major grid style={color=gray!80},
+ minor grid style={color=gray!20},
+ x label style={at={(ticklabel cs:0.5)},anchor=near ticklabel},
+ y label style={at={(ticklabel cs:0.5)},anchor=near ticklabel},
+ scale only axis,
+ samples=200,
+ width=5cm,
+ log basis x=10
+ }
+}
+\pgfplotsset{freq at filter/.style = {}}
+\def\freq at scale{1}
+\pgfplotsset{freq at label/.style = {xlabel = {Frequency (rad/s)}}}
+\pgfplotsset{ph at x@label/.style = {xlabel={Phase (deg)}}}
+\pgfplotsset{ph at y@label/.style = {ylabel={Phase (deg)}}}
+\def\ph at scale{180/pi}
+\if at radarg
+ \pgfplotsset{ph at y@label/.style = {ylabel={Phase (rad)}}}
+ \pgfplotsset{ph at x@label/.style = {xlabel={Phase (rad)}}}
+ \def\ph at scale{1}
+\fi
+\if at hzarg
+ \def\freq at scale{2*pi}
+ \pgfplotsset{freq at label/.style = {xlabel = {Frequency (Hz)}}}
+ \if at pgfarg
+ \pgfplotsset{freq at filter/.style = {x filter/.expression={x-log10(2*pi)}}}
+ \fi
+\fi
+\tikzset{
+ phase unit/.initial={deg},
+ phase unit/.default={deg},
+ phase unit/.is choice,
+ phase unit/deg/.code={
+ \renewcommand{\ph at scale}{180/pi}
+ \pgfplotsset{ph at x@label/.style = {xlabel={Phase (deg)}}}
+ \pgfplotsset{ph at y@label/.style = {ylabel={Phase (deg)}}}
+ },
+ phase unit/rad/.code={
+ \renewcommand{\ph at scale}{1}
+ \pgfplotsset{ph at y@label/.style = {ylabel={Phase (rad)}}}
+ \pgfplotsset{ph at x@label/.style = {xlabel={Phase (rad)}}}
+ },
+ frequency unit/.initial={rad},
+ frequency unit/.default={rad},
+ frequency unit/.is choice,
+ frequency unit/Hz/.code={
+ \renewcommand{\freq at scale}{2*pi}
+ \pgfplotsset{freq at label/.style = {xlabel = {Frequency (Hz)}}}
+ \if at pgfarg
+ \pgfplotsset{freq at filter/.style = {x filter/.expression={x-log10(2*pi)}}}
+ \fi
+ },
+ frequency unit/rad/.code={
+ \renewcommand{\freq at scale}{1}
+ \pgfplotsset{freq at label/.style = {xlabel = {Frequency (rad/s)}}}
+ }
+}
+\def\get at interval@start#1:#2\@nil{#1}
+\def\get at interval@end#1:#2\@nil{#2}
+\newcommand*{\MagK}[2]{(20*log10(abs(#1)))}
+\newcommand*{\MagKAsymp}{\MagK}
+\newcommand*{\MagKLin}{\MagK}
+\newcommand*{\PhK}[2]{((#1<0?-pi:0)*\ph at scale)}
+\newcommand*{\PhKAsymp}{\PhK}
+\newcommand*{\PhKLin}{\PhK}
+\newcommand*{\MagDel}[2]{0}
+\newcommand*{\PhDel}[2]{(-#1*t*\ph at scale)}
+\newcommand*{\MagPole}[2]
+ {(-20*log10(sqrt(\n at pow{#1}{2} + \n at pow{t - (#2)}{2})))}
+\newcommand*{\MagPoleLin}[2]{(t < sqrt(\n at pow{#1}{2} + \n at pow{#2}{2}) ?
+ -20*log10(sqrt(\n at pow{#1}{2} + \n at pow{#2}{2})) :
+ -20*log10(t)
+ )}
+\newcommand*{\MagPoleAsymp}{\MagPoleLin}
+\newcommand*{\PhPole}[2]{((#1 > 0 ? (#2 > 0 ?
+ (\n at mod@p{-atan2((t - (#2)),-(#1))}{2*pi}) :
+ (-atan2((t - (#2)),-(#1)))) :
+ (-atan2((t - (#2)),-(#1))))*\ph at scale)}
+\newcommand*{\PhPoleLin}[2]{
+ ((abs(#1)+abs(#2) == 0 ? -pi/2 :
+ (t < (sqrt(\n at pow{#1}{2} + \n at pow{#2}{2}) /
+ (\n at pow{10}{sqrt(\n at pow{#1}{2}/(\n at pow{#1}{2} + \n at pow{#2}{2}))})) ?
+ (-atan2(-(#2),-(#1))) :
+ (t >= (sqrt(\n at pow{#1}{2} + \n at pow{#2}{2}) *
+ (\n at pow{10}{sqrt(\n at pow{#1}{2}/(\n at pow{#1}{2} + \n at pow{#2}{2}))})) ?
+ (#2>0?(#1>0?3*pi/2:-pi/2):-pi/2) :
+ (-atan2(-(#2),-(#1)) + (log10(t/(sqrt(\n at pow{#1}{2} + \n at pow{#2}{2}) /
+ (\n at pow{10}{sqrt(\n at pow{#1}{2}/(\n at pow{#1}{2} +
+ \n at pow{#2}{2}))}))))*((#2>0?(#1>0?3*pi/2:-pi/2):-pi/2) + atan2(-(#2),-(#1)))/
+ (log10(\n at pow{10}{sqrt((4*\n at pow{#1}{2})/
+ (\n at pow{#1}{2} + \n at pow{#2}{2}))}))))))*\ph at scale)}
+\newcommand*{\PhPoleAsymp}[2]{((t < (sqrt(\n at pow{#1}{2} + \n at pow{#2}{2})) ?
+ (-atan2(-(#2),-(#1))) :
+ (#2>0?(#1>0?3*pi/2:-pi/2):-pi/2))*\ph at scale)}
+\newcommand*{\MagZero}{0-\MagPole}
+\newcommand*{\MagZeroLin}{0-\MagPoleLin}
+\newcommand*{\MagZeroAsymp}{0-\MagPoleAsymp}
+\newcommand*{\PhZero}{0-\PhPole}
+\newcommand*{\PhZeroLin}{0-\PhPoleLin}
+\newcommand*{\PhZeroAsymp}{0-\PhPoleAsymp}
+\newcommand*{\MagCSPoles}[2]{(-20*log10(sqrt(\n at pow{\n at pow{#2}{2}
+ - \n at pow{t}{2}}{2} + \n at pow{2*#1*#2*t}{2})))}
+\newcommand*{\MagCSPolesLin}[2]{(t < #2 ? -40*log10(#2) : - 40*log10(t))}
+\newcommand*{\MagCSPolesAsymp}{\MagCSPolesLin}
+\newcommand*{\PhCSPoles}[2]{((-atan2((2*(#1)*(#2)*t),(\n at pow{#2}{2}
+ - \n at pow{t}{2})))*\ph at scale)}
+\newcommand*{\PhCSPolesLin}[2]{((t < (#2 / (\n at pow{10}{abs(#1)})) ?
+ 0 :
+ (t >= (#2 * (\n at pow{10}{abs(#1)})) ?
+ (#1>0 ? -pi : pi) :
+ (#1>0 ? (-pi*(log10(t*(\n at pow{10}{#1})/#2))/(2*#1)) :
+ (pi*(log10(t*(\n at pow{10}{abs(#1)})/#2))/(2*abs(#1))))))*\ph at scale)}
+\newcommand*{\PhCSPolesAsymp}[2]{((#1>0?(t<#2?0:-pi):(t<#2?0:pi))*\ph at scale)}
+\newcommand*{\MagCSZeros}{0-\MagCSPoles}
+\newcommand*{\MagCSZerosLin}{0-\MagCSPolesLin}
+\newcommand*{\MagCSZerosAsymp}{0-\MagCSPolesAsymp}
+\newcommand*{\PhCSZeros}{0-\PhCSPoles}
+\newcommand*{\PhCSZerosLin}{0-\PhCSPolesLin}
+\newcommand*{\PhCSZerosAsymp}{0-\PhCSPolesAsymp}
+\newcommand*{\MagCSPolesPeak}[3][]{
+ \draw[#1,->] (axis cs:{#3},{-40*log10(#3)}) --
+ (axis cs:{#3},{-40*log10(#3)-20*log10(2*abs(#2))})
+}
+\newcommand*{\MagCSZerosPeak}[3][]{
+ \draw[#1,->] (axis cs:{#3},{40*log10(#3)}) --
+ (axis cs:{#3},{40*log10(#3)+20*log10(2*abs(#2))})
+}
+\newcommand*{\MagSOPoles}[2]{
+ (-20*log10(sqrt(\n at pow{#2 - \n at pow{t}{2}}{2} + \n at pow{#1*t}{2})))}
+\newcommand*{\MagSOPolesLin}[2]{
+ (t < sqrt(abs(#2)) ? -20*log10(abs(#2)) : - 40*log10(t))}
+\newcommand*{\MagSOPolesAsymp}{\MagSOPolesLin}
+\newcommand*{\PhSOPoles}[2]{((-atan2((#1)*t,((#2) - \n at pow{t}{2})))*\ph at scale)}
+\newcommand*{\PhSOPolesLin}[2]{((#2>0 ?
+ \PhCSPolesLin{(#1/(2*sqrt(#2)))}{(sqrt(#2))} :
+ (#1>0 ? -pi : pi)))}
+\newcommand*{\PhSOPolesAsymp}[2]{((#2>0 ?
+ \PhCSPolesAsymp{(#1/(2*sqrt(#2)))}{(sqrt(#2))} :
+ (#1>0 ? -pi : pi)))}
+\newcommand*{\MagSOZeros}{0-\MagSOPoles}
+\newcommand*{\MagSOZerosLin}{0-\MagSOPolesLin}
+\newcommand*{\MagSOZerosAsymp}{0-\MagSOPolesAsymp}
+\newcommand*{\PhSOZeros}{0-\PhSOPoles}
+\newcommand*{\PhSOZerosLin}{0-\PhSOPolesLin}
+\newcommand*{\PhSOZerosAsymp}{0-\PhSOPolesAsymp}
+\newcommand*{\MagSOPolesPeak}[3][]{
+ \draw[#1,->] (axis cs:{sqrt(abs(#3))},{-20*log10(abs(#3))}) --
+ (axis cs:{sqrt(abs(#3))},{-20*log10(abs(#3)) -
+ 20*log10(abs(#2/sqrt(abs(#3))))});
+}
+\newcommand*{\MagSOZerosPeak}[3][]{
+ \draw[#1,->] (axis cs:{sqrt(abs(#3))},{20*log10(abs(#3))}) --
+ (axis cs:{sqrt(abs(#3))},{20*log10(abs(#3)) +
+ 20*log10(abs(#2/sqrt(abs(#3))))});
+}
+\newcommand{\BodeZPK}[4][approx/true]{
+ \parse at opt{#1}
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \build at ZPK@plot{\func at mag}{\func at ph}{\opt at approx}{#2}
+ \edef\temp at cmd{\noexpand\begin{groupplot}[
+ bode at style,
+ xmin=#3,
+ xmax=#4,
+ domain=#3*\freq at scale:#4*\freq at scale,
+ height=2.5cm,
+ xmode=log,
+ group style = {group size = 1 by 2,vertical sep=0.25cm},
+ \opt at group
+ ]}
+ \temp at cmd
+ \edef\temp at mag@cmd{\noexpand\nextgroupplot [ylabel={Gain (dB)}, xmajorticks=false, \optmag at axes]
+ \noexpand\addplot [freq at filter, variable=t, thick, \optmag at plot]}
+ \edef\temp at ph@cmd{\noexpand\nextgroupplot [ph at y@label, freq at label, \optph at axes]
+ \noexpand\addplot [freq at filter, variable=t, thick, \optph at plot]}
+ \if at pgfarg
+ \temp at mag@cmd {\func at mag};
+ \optmag at commands
+ \temp at ph@cmd {\func at ph};
+ \optph at commands
+ \else
+ \stepcounter{gnuplot at id}
+ \temp at mag@cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set xrange [#3*\freq at scale:#4*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot \func at mag;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2);
+ };
+ \optmag at commands
+ \stepcounter{gnuplot at id}
+ \temp at ph@cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set xrange [#3*\freq at scale:#4*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot \func at ph;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2);
+ };
+ \optph at commands
+ \fi
+ \end{groupplot}
+ \end{tikzpicture}
+}
+\AtBeginDocument{%
+ \if at babel
+ \let\Orig at BodeZPK\BodeZPK
+ \renewcommand{\BodeZPK}{%
+ \expandafter\shorthandoff\expandafter{\shorthand at list}
+ \BodeZPK at Shorthandoff
+ }
+ \newcommand{\BodeZPK at Shorthandoff}[4][]{%
+ \Orig at BodeZPK[#1]{#2}{#3}{#4}
+ \expandafter\shorthandon\expandafter{\shorthand at list}
+ }
+ \fi
+}
+\newcommand{\BodeTF}[4][]{
+ \parse at opt{#1}
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \build at TF@plot{\func at mag}{\func at ph}{#2}
+ \edef\temp at cmd{\noexpand\begin{groupplot}[
+ bode at style,
+ xmin=#3,
+ xmax=#4,
+ domain=#3*\freq at scale:#4*\freq at scale,
+ height=2.5cm,
+ xmode=log,
+ group style = {group size = 1 by 2,vertical sep=0.25cm},
+ \opt at group
+ ]}
+ \temp at cmd
+ \edef\temp at mag@cmd{\noexpand\nextgroupplot [ylabel={Gain (dB)}, xmajorticks=false, \optmag at axes]
+ \noexpand\addplot [freq at filter, variable=t, thick, \optmag at plot]}
+ \edef\temp at ph@cmd{\noexpand\nextgroupplot [ph at y@label, freq at label, \optph at axes]
+ \noexpand\addplot [freq at filter, variable=t, thick, \optph at plot]}
+ \if at pgfarg
+ \temp at mag@cmd {\func at mag};
+ \optmag at commands
+ \temp at ph@cmd {\n at mod{\func at ph}{2*pi*\ph at scale}};
+ \optph at commands
+ \else
+ \stepcounter{gnuplot at id}
+ \temp at mag@cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set xrange [#3*\freq at scale:#4*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot \func at mag;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2);
+ };
+ \optmag at commands
+ \stepcounter{gnuplot at id}
+ \temp at ph@cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set trange [#3*\freq at scale:#4*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot '+' using (t) : ((\func at ph)/(\ph at scale)) smooth unwrap;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2*\ph at scale);
+ };
+ \optph at commands
+ \fi
+ \end{groupplot}
+ \end{tikzpicture}
+}
+\AtBeginDocument{
+ \if at babel
+ \let\Orig at BodeTF\BodeTF
+ \renewcommand{\BodeTF}{%
+ \expandafter\shorthandoff\expandafter{\shorthand at list}
+ \BodeTF at Shorthandoff
+ }
+ \newcommand{\BodeTF at Shorthandoff}[4][]{%
+ \Orig at BodeTF[#1]{#2}{#3}{#4}
+ \expandafter\shorthandon\expandafter{\shorthand at list}
+ }
+ \fi
+}
+\newcommand{\addBodeZPKPlots}[3][true/{}]{
+ \foreach \approx/\opt in {#1} {
+ \gdef\plot at macro{}
+ \gdef\temp at macro{}
+ \ifnum\pdf at strcmp{#2}{phase}=0
+ \build at ZPK@plot{\temp at macro}{\plot at macro}{\approx}{#3}
+ \else
+ \build at ZPK@plot{\plot at macro}{\temp at macro}{\approx}{#3}
+ \fi
+ \if at pgfarg
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, thick, \opt]}
+ \temp at cmd {\plot at macro};
+ \else
+ \stepcounter{gnuplot at id}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \opt]}
+ \temp at cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set xrange [\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot \plot at macro;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2);
+ };
+ \fi
+ }
+}
+\newcommand{\addBodeTFPlot}[3][thick]{
+ \gdef\plot at macro{}
+ \gdef\temp at macro{}
+ \ifnum\pdf at strcmp{#2}{phase}=0
+ \build at TF@plot{\temp at macro}{\plot at macro}{#3}
+ \else
+ \build at TF@plot{\plot at macro}{\temp at macro}{#3}
+ \fi
+ \if at pgfarg
+ \ifnum\pdf at strcmp{#2}{phase}=0
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd {\n at mod{\plot at macro}{2*pi}};
+ \else
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd {\plot at macro};
+ \fi
+ \else
+ \stepcounter{gnuplot at id}
+ \ifnum\pdf at strcmp{#2}{phase}=0
+ \addplot [variable=t, #1] gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set trange [\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot '+' using (t) : ((\plot at macro)/(\ph at scale)) smooth unwrap;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2*\ph at scale);
+ };
+ \else
+ \addplot [variable=t, #1] gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set xrange [\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot \plot at macro;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2);
+ };
+ \fi
+ \fi
+}
+\newcommand{\addBodeComponentPlot}[2][thick]{
+ \if at pgfarg
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd {#2};
+ \else
+ \stepcounter{gnuplot at id}
+ \addplot [variable=t, #1] gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set dummy t;
+ set logscale x 10;
+ set xrange [\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale];
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ plot #2;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($1/(\freq at scale)):($2);
+ };
+ \fi
+}
+\AtBeginDocument{%
+ \if at babel
+ \AddToHook{env/BodePhPlot/begin}{\expandafter\shorthandoff\expandafter{\shorthand at list}}
+ \AddToHook{env/BodePhPlot/end}{\expandafter\shorthandon\expandafter{\shorthand at list}}
+ \fi
+}
+\NewDocumentEnvironment{BodePhPlot}{O{}mm+b}{
+ \parse at env@opt{#1}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\begin{semilogxaxis}[
+ ph at y@label,
+ freq at label,
+ bode at style,
+ xmin={#2},
+ xmax={#3},
+ domain=#2:#3,
+ height=2.5cm,
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ #4
+ \end{semilogxaxis}
+ \end{tikzpicture}
+}{}
+\AtBeginDocument{%
+ \if at babel
+ \AddToHook{env/BodeMagPlot/begin}{\expandafter\shorthandoff\expandafter{\shorthand at list}}
+ \AddToHook{env/BodeMagPlot/end}{\expandafter\shorthandon\expandafter{\shorthand at list}}
+ \fi
+}
+\NewDocumentEnvironment{BodeMagPlot}{O{}mm+b}{
+ \parse at env@opt{#1}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\begin{semilogxaxis}[
+ bode at style,
+ freq at label,
+ xmin={#2},
+ xmax={#3},
+ domain=#2:#3,
+ height=2.5cm,
+ ylabel={Gain (dB)},
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ #4
+ \end{semilogxaxis}
+ \end{tikzpicture}
+}{}
+\AtBeginDocument{%
+ \if at babel
+ \AddToHook{env/BodePlot/begin}{\expandafter\shorthandoff\expandafter{\shorthand at list}}
+ \AddToHook{env/BodePlot/end}{\expandafter\shorthandon\expandafter{\shorthand at list}}
+ \fi
+}
+\NewDocumentEnvironment{BodePlot}{O{}mm+b}{
+ \parse at env@opt{#1}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\begin{semilogxaxis}[
+ bode at style,
+ freq at label,
+ xmin={#2},
+ xmax={#3},
+ domain=#2:#3,
+ height=2.5cm,
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ #4
+ \end{semilogxaxis}
+ \end{tikzpicture}
+}{}
+\newcommand*{\add at feature}[3]{
+ \ifcat$\detokenize\expandafter{#1}$
+ \xdef#1{\unexpanded\expandafter{#1 0+#2}}
+ \else
+ \xdef#1{\unexpanded\expandafter{#1+#2}}
+ \fi
+ \foreach \y [count=\n] in #3 {
+ \xdef#1{\unexpanded\expandafter{#1}{\y}}
+ \xdef\Last at LoopValue{\n}
+ }
+ \ifnum\Last at LoopValue=1
+ \xdef#1{\unexpanded\expandafter{#1}{0}}
+ \fi
+}
+\newcommand{\build at ZPK@plot}[4]{
+ \foreach \feature/\values in {#4} {
+ \ifnum\pdf at strcmp{\feature}{z}=0
+ \foreach \z in \values {
+ \ifnum\pdf at strcmp{#3}{linear}=0
+ \add at feature{#2}{\PhZeroLin}{\z}
+ \add at feature{#1}{\MagZeroLin}{\z}
+ \else
+ \ifnum\pdf at strcmp{#3}{asymptotic}=0
+ \add at feature{#2}{\PhZeroAsymp}{\z}
+ \add at feature{#1}{\MagZeroAsymp}{\z}
+ \else
+ \add at feature{#2}{\PhZero}{\z}
+ \add at feature{#1}{\MagZero}{\z}
+ \fi
+ \fi
+ }
+ \fi
+ \ifnum\pdf at strcmp{\feature}{p}=0
+ \foreach \p in \values {
+ \ifnum\pdf at strcmp{#3}{linear}=0
+ \add at feature{#2}{\PhPoleLin}{\p}
+ \add at feature{#1}{\MagPoleLin}{\p}
+ \else
+ \ifnum\pdf at strcmp{#3}{asymptotic}=0
+ \add at feature{#2}{\PhPoleAsymp}{\p}
+ \add at feature{#1}{\MagPoleAsymp}{\p}
+ \else
+ \add at feature{#2}{\PhPole}{\p}
+ \add at feature{#1}{\MagPole}{\p}
+ \fi
+ \fi
+ }
+ \fi
+ \ifnum\pdf at strcmp{\feature}{k}=0
+ \ifnum\pdf at strcmp{#3}{linear}=0
+ \add at feature{#2}{\PhKLin}{\values}
+ \add at feature{#1}{\MagKLin}{\values}
+ \else
+ \ifnum\pdf at strcmp{#3}{asymptotic}=0
+ \add at feature{#2}{\PhKAsymp}{\values}
+ \add at feature{#1}{\MagKAsymp}{\values}
+ \else
+ \add at feature{#2}{\PhK}{\values}
+ \add at feature{#1}{\MagK}{\values}
+ \fi
+ \fi
+ \fi
+ \ifnum\pdf at strcmp{\feature}{d}=0
+ \ifnum\pdf at strcmp{#3}{linear}=0
+ \PackageError {bodeplot} {Linear approximation for pure delays is not
+ supported.} {Plot the true Bode plot using `true' instead of `linear'.}
+ \else
+ \ifnum\pdf at strcmp{#3}{asymptotic}=0
+ \PackageError {bodeplot} {Asymptotic approximation for pure delays is not
+ supported.} {Plot the true Bode plot using `true' instead of `asymptotic'.}
+ \else
+ \ifdim\values pt < 0pt
+ \PackageError {bodeplot} {Delay needs to be a positive number.}
+ \fi
+ \add at feature{#2}{\PhDel}{\values}
+ \add at feature{#1}{\MagDel}{\values}
+ \fi
+ \fi
+ \fi
+ }
+}
+\newcommand{\build at TF@plot}[3]{
+ \gdef\num at real{0}
+ \gdef\num at im{0}
+ \gdef\den at real{0}
+ \gdef\den at im{0}
+ \gdef\loop at delay{0}
+ \foreach \feature/\values in {#3} {
+ \ifnum\pdf at strcmp{\feature}{num}=0
+ \foreach \numcoeff [count=\numpow] in \values {
+ \xdef\num at degree{\numpow}
+ }
+ \foreach \numcoeff [count=\numpow] in \values {
+ \pgfmathtruncatemacro{\currentdegree}{\num at degree-\numpow}
+ \ifnum\currentdegree = 0
+ \xdef\num at real{\num at real+\numcoeff}
+ \else
+ \ifodd\currentdegree
+ \xdef\num at im{\num at im+(\numcoeff*(\n at pow{-1}{(\currentdegree-1)/2})*%
+ (\n at pow{t}{\currentdegree}))}
+ \else
+ \xdef\num at real{\num at real+(\numcoeff*(\n at pow{-1}{(\currentdegree)/2})*%
+ (\n at pow{t}{\currentdegree}))}
+ \fi
+ \fi
+ }
+ \fi
+ \ifnum\pdf at strcmp{\feature}{den}=0
+ \foreach \dencoeff [count=\denpow] in \values {
+ \xdef\den at degree{\denpow}
+ }
+ \foreach \dencoeff [count=\denpow] in \values {
+ \pgfmathtruncatemacro{\currentdegree}{\den at degree-\denpow}
+ \ifnum\currentdegree = 0
+ \xdef\den at real{\den at real+\dencoeff}
+ \else
+ \ifodd\currentdegree
+ \xdef\den at im{\den at im+(\dencoeff*(\n at pow{-1}{(\currentdegree-1)/2})*%
+ (\n at pow{t}{\currentdegree}))}
+ \else
+ \xdef\den at real{\den at real+(\dencoeff*(\n at pow{-1}{(\currentdegree)/2})*%
+ (\n at pow{t}{\currentdegree}))}
+ \fi
+ \fi
+ }
+ \fi
+ \ifnum\pdf at strcmp{\feature}{d}=0
+ \xdef\loop at delay{\values}
+ \fi
+ }
+ \xdef#2{((atan2((\num at im),(\num at real))-atan2((\den at im),%
+ (\den at real))-\loop at delay*t)*(\ph at scale))}
+ \xdef#1{(20*log10(sqrt((\n at pow{\num at real}{2})+(\n at pow{\num at im}{2})))-%
+ 20*log10(sqrt((\n at pow{\den at real}{2})+(\n at pow{\den at im}{2}))))}
+}
+\newcommand{\parse at opt}[1]{
+ \gdef\optmag at axes{}
+ \gdef\optph at axes{}
+ \gdef\optph at plot{}
+ \gdef\optmag at plot{}
+ \gdef\opt at group{}
+ \gdef\opt at approx{}
+ \gdef\optph at commands{}
+ \gdef\optmag at commands{}
+ \gdef\opt at tikz{}
+ \foreach \obj/\typ/\opt in {#1} {
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{plot}=0
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\typ}}{mag}=0
+ \xdef\optmag at plot{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\typ}}{ph}=0
+ \xdef\optph at plot{\unexpanded\expandafter{\opt}}
+ \else
+ \xdef\optmag at plot{\unexpanded\expandafter{\opt}}
+ \xdef\optph at plot{\unexpanded\expandafter{\opt}}
+ \fi
+ \fi
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{axes}=0
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\typ}}{mag}=0
+ \xdef\optmag at axes{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\typ}}{ph}=0
+ \xdef\optph at axes{\unexpanded\expandafter{\opt}}
+ \else
+ \xdef\optmag at axes{\unexpanded\expandafter{\opt}}
+ \xdef\optph at axes{\unexpanded\expandafter{\opt}}
+ \fi
+ \fi
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{group}=0
+ \xdef\opt at group{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{approx}=0
+ \xdef\opt at approx{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{commands}=0
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\typ}}{ph}=0
+ \xdef\optph at commands{\unexpanded\expandafter{\opt}}
+ \else
+ \xdef\optmag at commands{\unexpanded\expandafter{\opt}}
+ \fi
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{tikz}=0
+ \xdef\opt at tikz{\unexpanded\expandafter{\opt}}
+ \else
+ \xdef\optmag at plot{\unexpanded\expandafter{\optmag at plot},
+ \unexpanded\expandafter{\obj}}
+ \xdef\optph at plot{\unexpanded\expandafter{\optph at plot},
+ \unexpanded\expandafter{\obj}}
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ }
+}
+\newcommand{\parse at env@opt}[1]{
+ \gdef\opt at axes{}
+ \gdef\opt at tikz{}
+ \foreach \obj/\opt in {#1} {
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{axes}=0
+ \xdef\opt at axes{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{tikz}=0
+ \xdef\opt at tikz{\unexpanded\expandafter{\opt}}
+ \else
+ \xdef\opt at axes{\unexpanded\expandafter{\opt at axes},
+ \unexpanded\expandafter{\obj}}
+ \fi
+ \fi
+ }
+}
+\newcommand{\NyquistZPK}[4][]{
+ \parse at N@opt{#1}
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
+ \edef\temp at cmd{\noexpand\begin{axis}[
+ bode at style,
+ domain=#3*\freq at scale:#4*\freq at scale,
+ height=5cm,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ samples=500,
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ \addplot [only marks,mark=+,thick,red] (-1 , 0);
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \unexpanded\expandafter{\opt at plot}]}
+ \if at pgfarg
+ \temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
+ {\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
+ \opt at commands
+ \else
+ \stepcounter{gnuplot at id}
+ \temp at cmd gnuplot [parametric, gnuplot at prefix] {
+ \n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale)),
+ \n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))
+ };
+ \opt at commands
+ \fi
+ \end{axis}
+ \end{tikzpicture}
+}
+\AtBeginDocument{%
+ \if at babel
+ \let\Orig at NyquistZPK\NyquistZPK
+ \renewcommand{\NyquistZPK}{%
+ \expandafter\shorthandoff\expandafter{\shorthand at list}
+ \NyquistZPK at Shorthandoff
+ }
+ \newcommand{\NyquistZPK at Shorthandoff}[4][]{%
+ \Orig at NyquistZPK[#1]{#2}{#3}{#4}
+ \expandafter\shorthandon\expandafter{\shorthand at list}
+ }
+ \fi
+}
+\newcommand{\NyquistTF}[4][]{
+ \parse at N@opt{#1}
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \build at TF@plot{\func at mag}{\func at ph}{#2}
+ \edef\temp at cmd{\noexpand\begin{axis}[
+ bode at style,
+ domain=#3*\freq at scale:#4*\freq at scale,
+ height=5cm,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ samples=500,
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ \addplot [only marks, mark=+, thick, red] (-1 , 0);
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \unexpanded\expandafter{\opt at plot}]}
+ \if at pgfarg
+ \temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
+ {\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
+ \opt at commands
+ \else
+ \stepcounter{gnuplot at id}
+ \temp at cmd gnuplot [parametric, gnuplot at prefix] {
+ \n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale)),
+ \n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))
+ };
+ \opt at commands
+ \fi
+ \end{axis}
+ \end{tikzpicture}
+}
+\AtBeginDocument{%
+ \if at babel
+ \let\Orig at NyquistTF\NyquistTF
+ \renewcommand{\NyquistTF}{%
+ \expandafter\shorthandoff\expandafter{\shorthand at list}
+ \NyquistTF at Shorthandoff
+ }
+ \newcommand{\NyquistTF at Shorthandoff}[4][]{%
+ \Orig at NyquistTF[#1]{#2}{#3}{#4}
+ \expandafter\shorthandon\expandafter{\shorthand at list}
+ }
+ \fi
+}
+\newcommand{\addNyquistZPKPlot}[2][]{
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
+ \if at pgfarg
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
+ {\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
+ \else
+ \stepcounter{gnuplot at id}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd gnuplot [parametric, gnuplot at prefix] {
+ \n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale)),
+ \n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))
+ };
+ \fi
+}
+\newcommand{\addNyquistTFPlot}[2][]{
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \build at TF@plot{\func at mag}{\func at ph}{#2}
+ \if at pgfarg
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
+ {\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
+ \else
+ \stepcounter{gnuplot at id}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd gnuplot [parametric, gnuplot at prefix]{
+ \n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale)),
+ \n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))
+ };
+ \fi
+}
+\AtBeginDocument{%
+ \if at babel
+ \AddToHook{env/NyquistPlot/begin}{\expandafter\shorthandoff\expandafter{\shorthand at list}}
+ \AddToHook{env/NyquistPlot/end}{\expandafter\shorthandon\expandafter{\shorthand at list}}
+ \fi
+}
+\NewDocumentEnvironment{NyquistPlot}{O{}mm+b}{
+ \parse at env@opt{#1}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\begin{axis}[
+ bode at style,
+ height=5cm,
+ domain=#2:#3,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ \addplot [only marks,mark=+,thick,red] (-1 , 0);
+ #4
+ \end{axis}
+ \end{tikzpicture}
+}{}
+\newcommand{\parse at N@opt}[1]{
+ \gdef\opt at axes{}
+ \gdef\opt at plot{}
+ \gdef\opt at commands{}
+ \gdef\opt at tikz{}
+ \foreach \obj/\opt in {#1} {
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{axes}=0
+ \xdef\opt at axes{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{plot}=0
+ \xdef\opt at plot{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{commands}=0
+ \xdef\opt at commands{\unexpanded\expandafter{\opt}}
+ \else
+ \ifnum\pdf at strcmp{\unexpanded\expandafter{\obj}}{tikz}=0
+ \xdef\opt at tikz{\unexpanded\expandafter{\opt}}
+ \else
+ \xdef\opt at plot{\unexpanded\expandafter{\opt at plot},
+ \unexpanded\expandafter{\obj}}
+ \fi
+ \fi
+ \fi
+ \fi
+ }
+}
+\newcommand{\NicholsZPK}[4][]{
+ \parse at N@opt{#1}
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
+ \edef\temp at cmd{\noexpand\begin{axis}[
+ ph at x@label,
+ bode at style,
+ domain=#3*\freq at scale:#4*\freq at scale,
+ height=5cm,
+ ylabel={Gain (dB)},
+ samples=500,
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\addplot [variable=t,thick,\opt at plot]}
+ \if at pgfarg
+ \temp at cmd ( {\func at ph} , {\func at mag} );
+ \opt at commands
+ \else
+ \stepcounter{gnuplot at id}
+ \temp at cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set logscale x 10;
+ set dummy t;
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ set trange [#3*\freq at scale:#4*\freq at scale];
+ plot '+' using (\func at mag) : ((\func at ph)/(\ph at scale));
+ unset logscale x;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($2*\ph at scale):($1);
+ };
+ \opt at commands
+ \fi
+ \end{axis}
+ \end{tikzpicture}
+}
+\AtBeginDocument{%
+ \if at babel
+ \let\Orig at NicholsZPK\NicholsZPK
+ \renewcommand{\NicholsZPK}{%
+ \expandafter\shorthandoff\expandafter{\shorthand at list}
+ \NicholsZPK at Shorthandoff
+ }
+ \newcommand{\NicholsZPK at Shorthandoff}[4][]{%
+ \Orig at NicholsZPK[#1]{#2}{#3}{#4}
+ \expandafter\shorthandon\expandafter{\shorthand at list}
+ }
+ \fi
+}
+\newcommand{\NicholsTF}[4][]{
+ \parse at N@opt{#1}
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \build at TF@plot{\func at mag}{\func at ph}{#2}
+ \edef\temp at cmd{\noexpand\begin{axis}[
+ ph at x@label,
+ bode at style,
+ domain=#3*\freq at scale:#4*\freq at scale,
+ height=5cm,
+ ylabel={Gain (dB)},
+ samples=500,
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\addplot [variable=t,thick, \opt at plot]}
+ \if at pgfarg
+ \temp at cmd ( {\n at mod{\func at ph}{2*pi*\ph at scale}} , {\func at mag} );
+ \opt at commands
+ \else
+ \stepcounter{gnuplot at id}
+ \temp at cmd gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta1;
+ set logscale x 10;
+ set dummy t;
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ set trange [#3*\freq at scale:#4*\freq at scale];
+ plot '+' using (\func at mag) : ((\func at ph)/(\ph at scale));
+ unset logscale x;
+ set table $meta2;
+ plot "$meta1" using ($1):($2) smooth unwrap;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta2" using ($2*\ph at scale):($1);
+ };
+ \opt at commands
+ \fi
+ \end{axis}
+ \end{tikzpicture}
+}
+\AtBeginDocument{
+ \if at babel
+ \let\Orig at NicholsTF\NicholsTF
+ \renewcommand{\NicholsTF}{%
+ \expandafter\shorthandoff\expandafter{\shorthand at list}
+ \NicholsTF at Shorthandoff
+ }
+ \newcommand{\NicholsTF at Shorthandoff}[4][]{%
+ \Orig at NicholsTF[#1]{#2}{#3}{#4}
+ \expandafter\shorthandon\expandafter{\shorthand at list}
+ }
+ \AddToHook{env/NicholsChart/begin}{\expandafter\shorthandoff\expandafter{\shorthand at list}}
+ \AddToHook{env/NicholsChart/end}{\expandafter\shorthandon\expandafter{\shorthand at list}}
+ \fi
+}
+\NewDocumentEnvironment{NicholsChart}{O{}mm+b}{
+ \parse at env@opt{#1}
+ \edef\temp at cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt at tikz}]}
+ \temp at cmd
+ \edef\temp at cmd{\noexpand\begin{axis}[
+ ph at x@label,
+ bode at style,
+ domain=#2:#3,
+ height=5cm,
+ ylabel={Gain (dB)},
+ \unexpanded\expandafter{\opt at axes}
+ ]}
+ \temp at cmd
+ #4
+ \end{axis}
+ \end{tikzpicture}
+}{}
+\newcommand{\addNicholsZPKChart}[2][]{
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
+ \if at pgfarg
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd ( {\func at ph} , {\func at mag} );
+ \else
+ \stepcounter{gnuplot at id}
+ \addplot [#1] gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta;
+ set logscale x 10;
+ set dummy t;
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ set trange [\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale];
+ plot '+' using (\func at mag) : ((\func at ph)/(\ph at scale));
+ unset logscale x;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta" using ($2*\ph at scale):($1);
+ };
+ \fi
+}
+\newcommand{\addNicholsTFChart}[2][]{
+ \gdef\func at mag{}
+ \gdef\func at ph{}
+ \build at TF@plot{\func at mag}{\func at ph}{#2}
+ \if at pgfarg
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \temp at cmd ( {\n at mod{\func at ph}{2*pi*\ph at scale}} , {\func at mag} );
+ \else
+ \stepcounter{gnuplot at id}
+ \addplot [#1] gnuplot [raw gnuplot, gnuplot at prefix]
+ { set table $meta1;
+ set logscale x 10;
+ set dummy t;
+ set samples \pgfkeysvalueof{/pgfplots/samples};
+ set trange [\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale];
+ plot '+' using (\func at mag) : ((\func at ph)/(\ph at scale));
+ unset logscale x;
+ set table $meta2;
+ plot "$meta1" using ($1):($2) smooth unwrap;
+ set table "\bodeplot at prefix\arabic{gnuplot at id}.table";
+ plot "$meta2" using ($2*\ph at scale):($1);
+ };
+ \fi
+}
+\endinput
+%%
+%% End of file `bodeplot.sty'.
Property changes on: trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot-2024-02-06.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty 2024-04-19 16:27:56 UTC (rev 70999)
+++ trunk/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty 2024-04-19 21:07:11 UTC (rev 71000)
@@ -6,7 +6,7 @@
%%
%% bodeplot.dtx (with options: `package')
%% This is a generated file.
-%% Copyright (C) 2021 by Rushikesh Kamalapurkar
+%% Copyright (C) 2021-2024 by Rushikesh Kamalapurkar
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
@@ -14,8 +14,10 @@
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2006/05/20 or later.
-\NeedsTeXFormat{LaTeX2e}[2006/05/20]
-\ProvidesPackage{bodeplot}
+\NeedsTeXFormat{LaTeX2e}[2018/04/01]
+\DeclareRelease{}{2024-02-06}{bodeplot-2024-02-06.sty}
+\DeclareCurrentRelease{}{2024/04/18}
+\ProvidesPackage{bodeplot}[2024/04/18 v1.2 Generate Bode, Nichols, and Nyquist plots]
\RequirePackage{pdftexcmds}
\RequirePackage{ifplatform}
\RequirePackage{xparse}
@@ -45,9 +47,6 @@
\newcommand{\n at mod@n}[2]{(#1)-((floor((#1)/(#2))+1)*(#2))}
\if at pgfarg
\newcommand{\n at pow}[2]{(#1)^(#2)}
- \pgfplotsset{
- trig format plots=rad
- }
\else
\newcommand{\n at pow}[2]{(#1)**(#2)}
\newcounter{gnuplot at id}
@@ -264,7 +263,7 @@
\edef\temp at mag@cmd{\noexpand\nextgroupplot [ylabel={Gain (dB)}, xmajorticks=false, \optmag at axes]
\noexpand\addplot [freq at filter, variable=t, thick, \optmag at plot]}
\edef\temp at ph@cmd{\noexpand\nextgroupplot [ph at y@label, freq at label, \optph at axes]
- \noexpand\addplot [freq at filter, variable=t, thick, \optph at plot]}
+ \noexpand\addplot [freq at filter, variable=t, thick, trig format plots=rad, \optph at plot]}
\if at pgfarg
\temp at mag@cmd {\func at mag};
\optmag at commands
@@ -333,7 +332,7 @@
\edef\temp at mag@cmd{\noexpand\nextgroupplot [ylabel={Gain (dB)}, xmajorticks=false, \optmag at axes]
\noexpand\addplot [freq at filter, variable=t, thick, \optmag at plot]}
\edef\temp at ph@cmd{\noexpand\nextgroupplot [ph at y@label, freq at label, \optph at axes]
- \noexpand\addplot [freq at filter, variable=t, thick, \optph at plot]}
+ \noexpand\addplot [freq at filter, variable=t, thick, trig format plots=rad, \optph at plot]}
\if at pgfarg
\temp at mag@cmd {\func at mag};
\optmag at commands
@@ -391,7 +390,7 @@
\build at ZPK@plot{\plot at macro}{\temp at macro}{\approx}{#3}
\fi
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, thick, \opt]}
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, thick, trig format plots=rad, \opt]}
\temp at cmd {\plot at macro};
\else
\stepcounter{gnuplot at id}
@@ -419,7 +418,7 @@
\fi
\if at pgfarg
\ifnum\pdf at strcmp{#2}{phase}=0
- \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd {\n at mod{\plot at macro}{2*pi}};
\else
\edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
@@ -454,7 +453,7 @@
}
\newcommand{\addBodeComponentPlot}[2][thick]{
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [freq at filter, domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd {#2};
\else
\stepcounter{gnuplot at id}
@@ -776,7 +775,7 @@
]}
\temp at cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
- \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \unexpanded\expandafter{\opt at plot}]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \unexpanded\expandafter{\opt at plot}]}
\if at pgfarg
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
@@ -823,7 +822,7 @@
]}
\temp at cmd
\addplot [only marks, mark=+, thick, red] (-1 , 0);
- \edef\temp at cmd{\noexpand\addplot [variable=t, thick, \unexpanded\expandafter{\opt at plot}]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \unexpanded\expandafter{\opt at plot}]}
\if at pgfarg
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
@@ -857,7 +856,7 @@
\gdef\func at ph{}
\build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
\else
@@ -874,7 +873,7 @@
\gdef\func at ph{}
\build at TF@plot{\func at mag}{\func at ph}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\n at pow{10}{((\func at mag)/20)}*cos((\func at ph)/(\ph at scale))},
{\n at pow{10}{((\func at mag)/20)}*sin((\func at ph)/(\ph at scale))} );
\else
@@ -953,7 +952,7 @@
\unexpanded\expandafter{\opt at axes}
]}
\temp at cmd
- \edef\temp at cmd{\noexpand\addplot [variable=t,thick,\opt at plot]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \opt at plot]}
\if at pgfarg
\temp at cmd ( {\func at ph} , {\func at mag} );
\opt at commands
@@ -1005,7 +1004,7 @@
\unexpanded\expandafter{\opt at axes}
]}
\temp at cmd
- \edef\temp at cmd{\noexpand\addplot [variable=t,thick, \opt at plot]}
+ \edef\temp at cmd{\noexpand\addplot [variable=t, thick, trig format plots=rad, \opt at plot]}
\if at pgfarg
\temp at cmd ( {\n at mod{\func at ph}{2*pi*\ph at scale}} , {\func at mag} );
\opt at commands
@@ -1066,7 +1065,7 @@
\gdef\func at ph{}
\build at ZPK@plot{\func at mag}{\func at ph}{}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\func at ph} , {\func at mag} );
\else
\stepcounter{gnuplot at id}
@@ -1088,7 +1087,7 @@
\gdef\func at ph{}
\build at TF@plot{\func at mag}{\func at ph}{#2}
\if at pgfarg
- \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, #1]}
+ \edef\temp at cmd{\noexpand\addplot [domain=\freq at scale*\pgfkeysvalueof{/pgfplots/domain}*\freq at scale, variable=t, trig format plots=rad, #1]}
\temp at cmd ( {\n at mod{\func at ph}{2*pi*\ph at scale}} , {\func at mag} );
\else
\stepcounter{gnuplot at id}
More information about the tex-live-commits
mailing list.