summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib')
-rw-r--r--graphics/pgf/contrib/bodeplot/README.md86
-rw-r--r--graphics/pgf/contrib/bodeplot/bodeplot.dtx94
-rw-r--r--graphics/pgf/contrib/bodeplot/bodeplot.pdfbin498384 -> 498916 bytes
3 files changed, 92 insertions, 88 deletions
diff --git a/graphics/pgf/contrib/bodeplot/README.md b/graphics/pgf/contrib/bodeplot/README.md
index 51253697ee..f00aca2523 100644
--- a/graphics/pgf/contrib/bodeplot/README.md
+++ b/graphics/pgf/contrib/bodeplot/README.md
@@ -1,43 +1,43 @@
-# bodeplot
-LaTeX package to plot Bode, Nichols, and Nyquist diagrams.
-
-Inspired by the `bodegraph` package.
-
-Limitation: Phase plots from TF commands are wrapped between 0 and 360 degrees.
-
-Added functionality:
- - New `\BodeZPK` and `\BodeTF` commands to generate Bode plots of any transfer function given either poles, zeros, gain, and delay, or numerator and denominator coefficients and delay
- - Support for unstable poles and zeros.
- - Support for complex poles and zeros.
- - Support for general stable and unstable second order transfer functions.
- - Support for both `gnuplot` (default) and `pgfplots` (package option `pgf`).
- - Support for linear and asymptotic approximation of magnitude and phase plots of any transfer function given poles, zeros, and gain.
-
-Main Bode/Nyquist/Nichols commands:
-Given Zeros, Poles, Gain, and Delay (Bode plots support asymptotic and linear approximation for systems without delays):
- - `\BodeZPK[object1/type1/{options1},object2/type2/{options2},...]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}`
- - `\NicholsZPK[plot/{options},axes/{options}]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}`
- - `\NyquistZPK[plot/{options},axes/{options}]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}`
-
-Given Numerator and denominator coefficients and delay (does not support approximation yet):
- - `\BodeTF[object1/type1/{options1},object2/type2/{options2},...]{num/{coeff},den/{coeff},d/delay}{min-frequency}{max-frequency}`
- - `\NicholsTF[plot/{options},axes/{options}]{num/{coeff},den/{coeff},d/delay}`
- - `\NyquistTF[plot/{options},axes/{options}]{num/{coeff},den/{coeff},d/delay}`
-
-Other new environments and associated commands:
- - `BodePlot` environment
- - `\addBodeZPKPlots[{approximation1/{plot-options1}},{approximation2/{plot-options2}},...]{plot-type (phase or magnitude)}{z/{zeros},p/{poles},k/gain,d/delay}`
- - `\addBodeTFPlot[plot-options]{plot-type (phase or magnitude)}{num/{coeff},den/{coeff},d/delay}`
- - `\addBodeComponentPlot[plot-options]{basic_component_plot_command}`
- - Basic component plot commands: ***(append `Lin` to get linear approximation and `Asymp` to get asymptotic approximation)*** ***(change `Pole` to `Zero` to get inverse plots)*** ***(change `Mag` to `Ph` to get phase plots)***
- - `\MagK{a}` - Pure gain, G(s) = a.
- - `\MagPole{a}{b}` - Single pole at s = a+bi, G(s) = 1/(s - a-bi).
- - `\MagCSPoles{z}{w}` - Cannonical Second order system, G(s) = 1/(s^2 + 2zws + w^2).
- - `\MagSOPoles{a}{b}` - Second Order system, G(s) = 1/(s^2 + as + b).
- - `\MagDel{T}` - Pure delay, G(s) = exp(-Ts) (does not admit asymptotic approximation).
- - `NicholsChart` environment
- - `\addNicholsZPKChart[plot-options]{z/{zeros},p/{poles},k/gain,d/delay}`
- - `\addNicholsTFChart[plot-options]{num/{coeff},den/{coeff},d/delay}`
- - `NyquistPlot` environment
- - `\addNyquistZPKPlot[plot-options]{z/{zeros},p/{poles},k/gain,d/delay}`
- - `\addNyquistTFPlot[plot-options]{num/{coeff},den/{coeff},d/delay}`
+# bodeplot
+LaTeX package to plot Bode, Nichols, and Nyquist diagrams.
+
+Inspired by the `bodegraph` package.
+
+Limitation: Phase plots from TF commands are wrapped between 0 and 360 degrees.
+
+Added functionality:
+ - New `\BodeZPK` and `\BodeTF` commands to generate Bode plots of any transfer function given either poles, zeros, gain, and delay, or numerator and denominator coefficients and delay
+ - Support for unstable poles and zeros.
+ - Support for complex poles and zeros.
+ - Support for general stable and unstable second order transfer functions.
+ - Support for both `gnuplot` (default) and `pgfplots` (package option `pgf`).
+ - Support for linear and asymptotic approximation of magnitude and phase plots of any transfer function given poles, zeros, and gain.
+
+Main Bode/Nyquist/Nichols commands:
+Given Zeros, Poles, Gain, and Delay (Bode plots support asymptotic and linear approximation for systems without delays):
+ - `\BodeZPK[object1/type1/{options1},object2/type2/{options2},...]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}`
+ - `\NicholsZPK[plot/{options},axes/{options}]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}`
+ - `\NyquistZPK[plot/{options},axes/{options}]{z/{zeros},p/{poles},k/gain,d/delay}{min-frequency}{max-frequency}`
+
+Given Numerator and denominator coefficients and delay (does not support approximation yet):
+ - `\BodeTF[object1/type1/{options1},object2/type2/{options2},...]{num/{coeff},den/{coeff},d/delay}{min-frequency}{max-frequency}`
+ - `\NicholsTF[plot/{options},axes/{options}]{num/{coeff},den/{coeff},d/delay}`
+ - `\NyquistTF[plot/{options},axes/{options}]{num/{coeff},den/{coeff},d/delay}`
+
+Other new environments and associated commands:
+ - `BodePlot` environment
+ - `\addBodeZPKPlots[{approximation1/{plot-options1}},{approximation2/{plot-options2}},...]{plot-type (phase or magnitude)}{z/{zeros},p/{poles},k/gain,d/delay}`
+ - `\addBodeTFPlot[plot-options]{plot-type (phase or magnitude)}{num/{coeff},den/{coeff},d/delay}`
+ - `\addBodeComponentPlot[plot-options]{basic_component_plot_command}`
+ - Basic component plot commands: ***(append `Lin` to get linear approximation and `Asymp` to get asymptotic approximation)*** ***(change `Pole` to `Zero` to get inverse plots)*** ***(change `Mag` to `Ph` to get phase plots)***
+ - `\MagK{a}` - Pure gain, G(s) = a.
+ - `\MagPole{a}{b}` - Single pole at s = a+bi, G(s) = 1/(s - a-bi).
+ - `\MagCSPoles{z}{w}` - Cannonical Second order system, G(s) = 1/(s^2 + 2zws + w^2).
+ - `\MagSOPoles{a}{b}` - Second Order system, G(s) = 1/(s^2 + as + b).
+ - `\MagDel{T}` - Pure delay, G(s) = exp(-Ts) (does not admit asymptotic approximation).
+ - `NicholsChart` environment
+ - `\addNicholsZPKChart[plot-options]{z/{zeros},p/{poles},k/gain,d/delay}`
+ - `\addNicholsTFChart[plot-options]{num/{coeff},den/{coeff},d/delay}`
+ - `NyquistPlot` environment
+ - `\addNyquistZPKPlot[plot-options]{z/{zeros},p/{poles},k/gain,d/delay}`
+ - `\addNyquistTFPlot[plot-options]{num/{coeff},den/{coeff},d/delay}`
diff --git a/graphics/pgf/contrib/bodeplot/bodeplot.dtx b/graphics/pgf/contrib/bodeplot/bodeplot.dtx
index 350e523ff6..7ebfd3b754 100644
--- a/graphics/pgf/contrib/bodeplot/bodeplot.dtx
+++ b/graphics/pgf/contrib/bodeplot/bodeplot.dtx
@@ -41,17 +41,18 @@
%</driver>
% \fi
%
-% \CheckSum{1287}
+% \CheckSum{1362}
%
% \changes{v1.0}{2021/10/25}{Initial release}
+% \changes{v1.0.4}{2021/11/05}{Fixed unintended optional argument macro expansion}
%
% \GetFileInfo{bodeplot.sty}
%
% \DoNotIndex{\newcommand,\xdef,\gdef,\def,\edef,\addplot,\approx,\arabic,\opt,\typ,\obj,\else,\if@pgfarg,\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\thanks{This document
-% corresponds to \textsf{bodeplot}~v1.0.3,
-% dated November 3, 2021.}}
+% corresponds to \textsf{bodeplot}~v1.0.4,
+% dated November 5, 2021.}}
% \author{Rushikesh Kamalapurkar \\ \texttt{rlkamalapurkar@gmail.com}}
%
% \maketitle
@@ -758,7 +759,7 @@
% \end{macrocode}
% The |\noexpand| macros below are needed to so that only the macro |\opt@group| is expanded. \changes{v1.0.3}{2021/11/03}{Added Tikz option}
% \begin{macrocode}
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{groupplot}[%
bodeStyle,
xmin={#3},
@@ -815,7 +816,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{groupplot}[%
bodeStyle,
xmin={#3},
@@ -920,7 +921,7 @@
% \begin{macrocode}
\newenvironment{BodePlot}[3][]{%
\parse@env@opt{#1}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]
\noexpand\begin{semilogxaxis}[%
bodeStyle,
xmin={#2},
@@ -928,7 +929,7 @@
domain=#2:#3,
height=2.5cm,
xlabel={Frequency (rad/s)},
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
@@ -1012,11 +1013,11 @@
\ifnum\pdfstrcmp{\feature}{d}=0
\ifnum\pdfstrcmp{#3}{linear}=0
\PackageError {bodeplot} {Linear approximation for pure delays is not
- supported.} {Plot the true Bode plot using 'true' instead of 'linear'.}
+ supported.} {Plot the true Bode plot using `true' instead of `linear'.}
\else
\ifnum\pdfstrcmp{#3}{asymptotic}=0
\PackageError {bodeplot} {Asymptotic approximation for pure delays is not
- supported.} {Plot the true Bode plot using 'true' instead of 'asymptotic'.}
+ 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.}
@@ -1103,11 +1104,11 @@
\gdef\optmag@commands{}%
\gdef\opt@tikz{}%
\foreach \obj/\typ/\opt in {#1} {%
- \ifnum\pdfstrcmp{\obj}{plot}=0
- \ifnum\pdfstrcmp{\typ}{mag}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{plot}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\typ}}{mag}=0
\xdef\optmag@plot{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\typ}{ph}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\typ}}{ph}=0
\xdef\optph@plot{\unexpanded\expandafter{\opt}}%
\else
\xdef\optmag@plot{\unexpanded\expandafter{\opt}}%
@@ -1115,11 +1116,11 @@
\fi
\fi
\else
- \ifnum\pdfstrcmp{\obj}{axes}=0
- \ifnum\pdfstrcmp{\typ}{mag}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{axes}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\typ}}{mag}=0
\xdef\optmag@axes{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\typ}{ph}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\typ}}{ph}=0
\xdef\optph@axes{\unexpanded\expandafter{\opt}}%
\else
\xdef\optmag@axes{\unexpanded\expandafter{\opt}}%
@@ -1127,24 +1128,26 @@
\fi
\fi
\else
- \ifnum\pdfstrcmp{\obj}{group}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{group}=0
\xdef\opt@group{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\obj}{approx}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{approx}=0
\xdef\opt@approx{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\obj}{commands}=0
- \ifnum\pdfstrcmp{\typ}{phase}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{commands}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\typ}}{phase}=0
\xdef\optph@commands{\unexpanded\expandafter{\opt}}%
\else
\xdef\optmag@commands{\unexpanded\expandafter{\opt}}%
\fi
\else
- \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{tikz}=0
\xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
\else
- \xdef\optmag@plot{\optmag@plot,\unexpanded\expandafter{\obj}}%
- \xdef\optph@plot{\optph@plot,\unexpanded\expandafter{\obj}}%
+ \xdef\optmag@plot{\unexpanded\expandafter{\optmag@plot},
+ \unexpanded\expandafter{\obj}}%
+ \xdef\optph@plot{\unexpanded\expandafter{\optph@plot},
+ \unexpanded\expandafter{\obj}}%
\fi
\fi
\fi
@@ -1162,13 +1165,14 @@
\gdef\opt@axes{}%
\gdef\opt@tikz{}%
\foreach \obj/\opt in {#1} {%
- \ifnum\pdfstrcmp{\obj}{axes}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{axes}=0
\xdef\opt@axes{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{tikz}=0
\xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
\else
- \xdef\opt@axes{\opt@axes,\unexpanded\expandafter{\obj}}%
+ \xdef\opt@axes{\unexpanded\expandafter{\opt@axes},
+ \unexpanded\expandafter{\obj}}%
\fi
\fi
}%
@@ -1185,7 +1189,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bodeStyle,
domain=#3:#4,
@@ -1193,7 +1197,7 @@
xlabel={$\Re$},
ylabel={$\Im$},
samples=500,
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
@@ -1223,7 +1227,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bodeStyle,
domain=#3:#4,
@@ -1231,7 +1235,7 @@
xlabel={$\Re$},
ylabel={$\Im$},
samples=500,
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
@@ -1295,15 +1299,15 @@
% An environment to host |\addNyquist...| macros that pass parametric functions to |\addplot|. Uses the defaults specified in |bodeStyle| to create a shortcut that includes the |tikzpicture| and |axis| environments. \changes{v1.0.3}{2021/11/03}{Added tikz option to environments}
% \begin{macrocode}
\newenvironment{NyquistPlot}[3][]{%
-\parse@env@opt{#1}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bodeStyle,
height=5cm,
domain=#2:#3,
xlabel={$\Re$},
ylabel={$\Im$},
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
@@ -1324,19 +1328,20 @@
\gdef\opt@commands{}%
\gdef\opt@tikz{}
\foreach \obj/\opt in {#1} {%
- \ifnum\pdfstrcmp{\obj}{axes}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{axes}=0
\xdef\opt@axes{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\obj}{plot}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{plot}=0
\xdef\opt@plot{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\obj}{commands}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{commands}=0
\xdef\opt@commands{\unexpanded\expandafter{\opt}}%
\else
- \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \ifnum\pdfstrcmp{\unexpanded\expandafter{\obj}}{tikz}=0
\xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
\else
- \xdef\opt@plot{\opt@plot,\unexpanded\expandafter{\obj}}%
+ \xdef\opt@plot{\unexpanded\expandafter{\opt@plot},
+ \unexpanded\expandafter{\obj}}%
\fi
\fi
\fi
@@ -1361,7 +1366,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bodeStyle,
domain=#3:#4,
@@ -1369,7 +1374,7 @@
xlabel={Phase (degrees)},
ylabel={Gain (dB)},
samples=500,
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
@@ -1391,7 +1396,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bodeStyle,
domain=#3:#4,
@@ -1399,7 +1404,7 @@
xlabel={Phase (degrees)},
ylabel={Gain (dB)},
samples=500,
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
@@ -1417,16 +1422,15 @@
\end{tikzpicture}
}
\newenvironment{NicholsChart}[3][]{%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bodeStyle,
domain=#2:#3,
height=5cm,
- ytick distance=20,
- xtick distance=15,
xlabel={Phase (degrees)},
ylabel={Gain (dB)},
- \opt@axes
+ \unexpanded\expandafter{\opt@axes}
]%
}%
\temp@cmd
diff --git a/graphics/pgf/contrib/bodeplot/bodeplot.pdf b/graphics/pgf/contrib/bodeplot/bodeplot.pdf
index 64592fd6ec..bd20ff3dd5 100644
--- a/graphics/pgf/contrib/bodeplot/bodeplot.pdf
+++ b/graphics/pgf/contrib/bodeplot/bodeplot.pdf
Binary files differ