summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-11-05 22:01:30 +0000
committerKarl Berry <karl@freefriends.org>2021-11-05 22:01:30 +0000
commit4dd393717b3ec1f67c90dcf5bc7a7e071aef8c2b (patch)
tree3e0f364839a14574b467065a3f60bd2bd37e555a /Master/texmf-dist/tex
parent79d813365815f0876fa8037e0dc99e44085580f5 (diff)
bodeplot (5nov21)
git-svn-id: svn://tug.org/texlive/trunk@60958 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty325
1 files changed, 197 insertions, 128 deletions
diff --git a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
index 8cdbf5ce56f..6c2eb9d5798 100644
--- a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
+++ b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
@@ -43,7 +43,7 @@
\tikzset{%
gnuplot def/.style={%
id=\arabic{idGnuplot},
- prefix=gnuplot/
+ prefix=gnuplot/\jobname
}%
}
\pgfplotsset{%
@@ -172,84 +172,92 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{\opt@approx}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{groupplot}[%
- bodeStyle,
- xmin={#3},
- xmax={#4},
- domain=#3:#4,
- height=2.5cm,
- xmode=log,
- group style = {group size = 1 by 2,vertical sep=0.25cm,},
- \opt@group,]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{groupplot}[%
+ bodeStyle,
+ xmin={#3},
+ xmax={#4},
+ domain=#3:#4,
+ height=2.5cm,
+ xmode=log,
+ group style = {group size = 1 by 2,vertical sep=0.25cm},
+ \opt@group
+ ]%
+ }%
\temp@cmd
- \if@pgfarg
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd {\func@mag};
- \optmag@commands;
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd {\func@ph};
- \optph@commands;
- \else
- \stepcounter{idGnuplot}
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
- \optmag@commands;
- \stepcounter{idGnuplot}
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
- \optph@commands;
- \fi
- \end{groupplot}\end{tikzpicture}
+ \if@pgfarg
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd {\func@mag};
+ \optmag@commands;
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd {\func@ph};
+ \optph@commands;
+ \else
+ \stepcounter{idGnuplot}
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
+ \optmag@commands;
+ \stepcounter{idGnuplot}
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
+ \optph@commands;
+ \fi
+ \end{groupplot}
+ \end{tikzpicture}
}
\newcommand{\BodeTF}[4][]{%
\parse@opt{#1}%
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{groupplot}[%
- bodeStyle,
- xmin={#3},
- xmax={#4},
- domain=#3:#4,
- height=2.5cm,
- xmode=log,
- group style = {group size = 1 by 2,vertical sep=0.25cm,},
- \opt@group,]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{groupplot}[%
+ bodeStyle,
+ xmin={#3},
+ xmax={#4},
+ domain=#3:#4,
+ height=2.5cm,
+ xmode=log,
+ group style = {group size = 1 by 2,vertical sep=0.25cm},
+ \opt@group
+ ]%
+ }%
\temp@cmd
- \if@pgfarg
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd {\func@mag};
- \optmag@commands;%
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd {\func@ph};
- \optph@commands;%
- \else
- \stepcounter{idGnuplot}%
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
- \optmag@commands;%
- \stepcounter{idGnuplot}%
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
- \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
- \optph@commands;%
- \fi
- \end{groupplot}\end{tikzpicture}
+ \if@pgfarg
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd {\func@mag};
+ \optmag@commands;
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd {\func@ph};
+ \optph@commands;
+ \else
+ \stepcounter{idGnuplot}%
+ \expandafter\nextgroupplot\expandafter[ytick distance=20,
+ ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optmag@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@mag};
+ \optmag@commands;
+ \stepcounter{idGnuplot}%
+ \expandafter\nextgroupplot\expandafter[ytick distance=45,
+ ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
+ \temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
+ \optph@commands;
+ \fi
+ \end{groupplot}
+ \end{tikzpicture}
}
\newcommand{\addBodeZPKPlots}[3][true/{}]{%
\foreach \approx/\opt in {#1} {%
@@ -294,17 +302,21 @@
\fi
}
\newenvironment{BodePlot}[3][]{%
- \begin{tikzpicture}
- \begin{semilogxaxis}[%
+ \parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]
+ \noexpand\begin{semilogxaxis}[%
bodeStyle,
xmin={#2},
xmax={#3},
domain=#2:#3,
height=2.5cm,
xlabel={Frequency (rad/s)},
- #1]
+ \opt@axes
+ ]%
+ }%
+ \temp@cmd
}{
- \end{semilogxaxis}
+ \end{semilogxaxis}
\end{tikzpicture}
}
\newcommand*{\add@feature}[3]{%
@@ -449,38 +461,39 @@
\gdef\optmag@plot{}%
\gdef\opt@group{}%
\gdef\opt@approx{}%
- \xdef\optph@commands{}%
- \xdef\optmag@commands{}%
+ \gdef\optph@commands{}%
+ \gdef\optmag@commands{}%
+ \gdef\opt@tikz{}%
\foreach \obj/\typ/\opt in {#1} {%
\ifnum\pdfstrcmp{\obj}{plot}=0
\ifnum\pdfstrcmp{\typ}{mag}=0
- \xdef\optmag@plot{\optmag@plot,\opt}%
+ \xdef\optmag@plot{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\typ}{ph}=0
- \xdef\optph@plot{\optph@plot,\opt}%
+ \xdef\optph@plot{\unexpanded\expandafter{\opt}}%
\else
- \xdef\optmag@plot{\optmag@plot,\opt}%
- \xdef\optph@plot{\optph@plot,\opt}%
+ \xdef\optmag@plot{\unexpanded\expandafter{\opt}}%
+ \xdef\optph@plot{\unexpanded\expandafter{\opt}}%
\fi
\fi
\else
\ifnum\pdfstrcmp{\obj}{axes}=0
\ifnum\pdfstrcmp{\typ}{mag}=0
- \xdef\optmag@axes{\optmag@axes,\opt}%
+ \xdef\optmag@axes{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\typ}{ph}=0
- \xdef\optph@axes{\optph@axes,\opt}%
+ \xdef\optph@axes{\unexpanded\expandafter{\opt}}%
\else
- \xdef\optmag@axes{\optmag@axes,\opt}%
- \xdef\optph@axes{\optph@axes,\opt}%
+ \xdef\optmag@axes{\unexpanded\expandafter{\opt}}%
+ \xdef\optph@axes{\unexpanded\expandafter{\opt}}%
\fi
\fi
\else
\ifnum\pdfstrcmp{\obj}{group}=0
- \xdef\opt@group{\opt@group,\opt}%
+ \xdef\opt@group{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\obj}{approx}=0
- \xdef\opt@approx{\opt}%
+ \xdef\opt@approx{\unexpanded\expandafter{\opt}}%
\else
\ifnum\pdfstrcmp{\obj}{commands}=0
\ifnum\pdfstrcmp{\typ}{phase}=0
@@ -489,8 +502,12 @@
\xdef\optmag@commands{\unexpanded\expandafter{\opt}}%
\fi
\else
- \xdef\optmag@plot{\optmag@plot,\obj}%
- \xdef\optph@plot{\optph@plot,\obj}%
+ \ifnum\pdfstrcmp{\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}}%
+ \fi
\fi
\fi
\fi
@@ -498,30 +515,50 @@
\fi
}%
}
+\newcommand{\parse@env@opt}[1]{%
+ \gdef\opt@axes{}%
+ \gdef\opt@tikz{}%
+ \foreach \obj/\opt in {#1} {%
+ \ifnum\pdfstrcmp{\obj}{axes}=0
+ \xdef\opt@axes{\unexpanded\expandafter{\opt}}%
+ \else
+ \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
+ \else
+ \xdef\opt@axes{\opt@axes,\unexpanded\expandafter{\obj}}%
+ \fi
+ \fi
+ }%
+}
\newcommand{\NyquistZPK}[4][]{%
\parse@N@opt{#1}%
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={$\Re$},
- ylabel={$\Im$},
- samples=500,
- \opt@axes,]}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
\edef\temp@cmd{\noexpand\addplot[thick,\unexpanded\expandafter{\opt@plot}]}%
\if@pgfarg
\temp@cmd ( {\n@pow{10}{((\func@mag)/20)}*cos(\func@ph)},
{\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric,gnuplot degrees,gnuplot def] {%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
@@ -531,25 +568,30 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={$\Re$},
- ylabel={$\Im$},
- samples=500,
- \opt@axes,]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={$\Re$},
+ ylabel={$\Im$},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
\edef\temp@cmd{\noexpand\addplot[thick,\unexpanded\expandafter{\opt@plot}]}%
\if@pgfarg
\temp@cmd ( {\n@pow{10}{((\func@mag)/20)}*cos(\func@ph)},
{\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric,gnuplot degrees,gnuplot def]{%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
@@ -583,14 +625,18 @@
\fi
}
\newenvironment{NyquistPlot}[3][]{%
- \begin{tikzpicture}
- \begin{axis}[%
+\parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
bodeStyle,
height=5cm,
domain=#2:#3,
xlabel={$\Re$},
ylabel={$\Im$},
- #1]
+ \opt@axes
+ ]%
+ }%
+ \temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
}{%
\end{axis}
@@ -599,6 +645,8 @@
\newcommand{\parse@N@opt}[1]{%
\gdef\opt@axes{}%
\gdef\opt@plot{}%
+ \gdef\opt@commands{}%
+ \gdef\opt@tikz{}
\foreach \obj/\opt in {#1} {%
\ifnum\pdfstrcmp{\obj}{axes}=0
\xdef\opt@axes{\unexpanded\expandafter{\opt}}%
@@ -606,7 +654,15 @@
\ifnum\pdfstrcmp{\obj}{plot}=0
\xdef\opt@plot{\unexpanded\expandafter{\opt}}%
\else
- \xdef\opt@plot{\unexpanded\expandafter{\obj}}%
+ \ifnum\pdfstrcmp{\obj}{commands}=0
+ \xdef\opt@commands{\unexpanded\expandafter{\opt}}%
+ \else
+ \ifnum\pdfstrcmp{\obj}{tikz}=0
+ \xdef\opt@tikz{\unexpanded\expandafter{\opt}}%
+ \else
+ \xdef\opt@plot{\opt@plot,\unexpanded\expandafter{\obj}}%
+ \fi
+ \fi
\fi
\fi
}%
@@ -616,22 +672,27 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={Phase (degrees)},
- ylabel={Gain (dB)},
- samples=500,
- \opt@axes]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={Phase (degrees)},
+ ylabel={Gain (dB)},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\edef\temp@cmd{\noexpand\addplot[thick,\opt@plot]}%
\if@pgfarg
\temp@cmd ( {\func@ph} , {\func@mag} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric, gnuplot degrees, gnuplot def]
{ \func@ph , \func@mag };
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
@@ -641,29 +702,34 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}\noexpand\begin{axis}[%
- bodeStyle,
- domain=#3:#4,
- height=5cm,
- xlabel={Phase (degrees)},
- ylabel={Gain (dB)},
- samples=500,
- \opt@axes]}
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
+ bodeStyle,
+ domain=#3:#4,
+ height=5cm,
+ xlabel={Phase (degrees)},
+ ylabel={Gain (dB)},
+ samples=500,
+ \opt@axes
+ ]%
+ }%
\temp@cmd
\edef\temp@cmd{\noexpand\addplot[thick,\opt@plot]}%
\if@pgfarg
\temp@cmd ( {\func@ph} , {\func@mag} );
+ \opt@commands;
\else
\stepcounter{idGnuplot}%
\temp@cmd gnuplot[parametric, gnuplot degrees, gnuplot def]
{ \func@ph , \func@mag };
+ \opt@commands;
\fi
\end{axis}
\end{tikzpicture}
}
\newenvironment{NicholsChart}[3][]{%
- \begin{tikzpicture}
- \begin{axis}[%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture}[\opt@tikz]%
+ \noexpand\begin{axis}[%
bodeStyle,
domain=#2:#3,
height=5cm,
@@ -671,7 +737,10 @@
xtick distance=15,
xlabel={Phase (degrees)},
ylabel={Gain (dB)},
- #1]
+ \opt@axes
+ ]%
+ }%
+ \temp@cmd
}{
\end{axis}
\end{tikzpicture}