summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bodeplot
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-11-03 20:48:02 +0000
committerKarl Berry <karl@freefriends.org>2021-11-03 20:48:02 +0000
commitc9f727464c7c3b71a78d84bc99f5e8f1125f92a1 (patch)
tree27f397b4d1f2cb2a8e7c612a8766e676543376f3 /Master/texmf-dist/tex/latex/bodeplot
parenta2fc878c89c2df744ad66f43a8d054ea6abd1362 (diff)
bodeplot (3nov21)
git-svn-id: svn://tug.org/texlive/trunk@60932 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bodeplot')
-rw-r--r--Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty68
1 files changed, 46 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
index 27bd7d37c0b..8cdbf5ce56f 100644
--- a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
+++ b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
@@ -18,12 +18,13 @@
\ProvidesPackage{bodeplot}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
+ \RequirePackage{pdftexcmds}
+ \RequirePackage{ifplatform}
\pgfplotsset{compat=1.18,variable=t}
\usepgfplotslibrary{groupplots}
\RequirePackage{ifluatex}%
\ifluatex
- \RequirePackage{pdftexcmds}%
\let\pdfstrcmp\pdf@strcmp
\fi
\newif\if@pgfarg\@pgfargfalse
@@ -52,6 +53,9 @@
\fi
}%
}
+ \ifwindows\else
+ \immediate\write18{mkdir -p gnuplot}%
+ \fi
\fi
\pgfplotsset{%
bodeStyle/.style = {%
@@ -163,7 +167,7 @@
(axis cs:{sqrt(abs(#3))},{20*log10(abs(#3)) +
20*log10(abs(#2/sqrt(abs(#3))))});
}
-\newcommand{\BodeZPK}[4][]{%
+\newcommand{\BodeZPK}[4][approx/true]{%
\parse@opt{#1}%
\gdef\func@mag{}%
\gdef\func@ph{}%
@@ -181,25 +185,30 @@
\if@pgfarg
\expandafter\nextgroupplot\expandafter[ytick distance=20,
ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[red,thick,\optmag@plot]}%
+ \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[red,thick,\optph@plot]}%
+ \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[red,thick,\optmag@plot]}%
+ \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[red,thick,\optph@plot]}%
+ \edef\temp@cmd{\noexpand\addplot[thick,\optph@plot]}%
\temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\func@ph};
+ \optph@commands;
\fi
- \end{groupplot}\end{tikzpicture}}
+ \end{groupplot}\end{tikzpicture}
+}
\newcommand{\BodeTF}[4][]{%
\parse@opt{#1}%
\gdef\func@mag{}%
@@ -218,26 +227,31 @@
\if@pgfarg
\expandafter\nextgroupplot\expandafter[ytick distance=20,
ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[red,thick,\optmag@plot]}%
+ \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[red,thick,\optph@plot]}%
+ \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[red,thick,\optmag@plot]}%
+ \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[red,thick,\optph@plot]}%
+ \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][{}]{%
+ \end{groupplot}\end{tikzpicture}
+}
+\newcommand{\addBodeZPKPlots}[3][true/{}]{%
\foreach \approx/\opt in {#1} {%
\gdef\plot@macro{}%
\gdef\temp@macro{}%
@@ -247,16 +261,16 @@
\build@ZPK@plot{\plot@macro}{\temp@macro}{\approx}{#3}%
\fi
\if@pgfarg
- \edef\temp@cmd{\noexpand\addplot[red,thick,\opt]}%
+ \edef\temp@cmd{\noexpand\addplot[thick,\opt]}%
\temp@cmd {\plot@macro};
\else
\stepcounter{idGnuplot}%
- \edef\temp@cmd{\noexpand\addplot[red,thick,\opt]}
+ \edef\temp@cmd{\noexpand\addplot[thick,\opt]}
\temp@cmd gnuplot[gnuplot degrees,gnuplot def] {\plot@macro};
\fi
}%
}
-\newcommand{\addBodeTFPlot}[3][red,thick]{%
+\newcommand{\addBodeTFPlot}[3][thick]{%
\gdef\plot@macro{}%
\gdef\temp@macro{}%
\ifnum\pdfstrcmp{#2}{phase}=0
@@ -271,7 +285,7 @@
\addplot[#1] gnuplot[gnuplot degrees, gnuplot def] {\plot@macro};
\fi
}
-\newcommand{\addBodeComponentPlot}[2][red,thick]{%
+\newcommand{\addBodeComponentPlot}[2][thick]{%
\if@pgfarg
\addplot[#1]{#2};
\else
@@ -435,6 +449,8 @@
\gdef\optmag@plot{}%
\gdef\opt@group{}%
\gdef\opt@approx{}%
+ \xdef\optph@commands{}%
+ \xdef\optmag@commands{}%
\foreach \obj/\typ/\opt in {#1} {%
\ifnum\pdfstrcmp{\obj}{plot}=0
\ifnum\pdfstrcmp{\typ}{mag}=0
@@ -464,10 +480,18 @@
\xdef\opt@group{\opt@group,\opt}%
\else
\ifnum\pdfstrcmp{\obj}{approx}=0
- \xdef\opt@approx{\typ}%
+ \xdef\opt@approx{\opt}%
\else
- \xdef\optmag@plot{\optmag@plot,\obj}%
- \xdef\optph@plot{\optph@plot,\obj}%
+ \ifnum\pdfstrcmp{\obj}{commands}=0
+ \ifnum\pdfstrcmp{\typ}{phase}=0
+ \xdef\optph@commands{\unexpanded\expandafter{\opt}}%
+ \else
+ \xdef\optmag@commands{\unexpanded\expandafter{\opt}}%
+ \fi
+ \else
+ \xdef\optmag@plot{\optmag@plot,\obj}%
+ \xdef\optph@plot{\optph@plot,\obj}%
+ \fi
\fi
\fi
\fi
@@ -601,7 +625,7 @@
samples=500,
\opt@axes]}
\temp@cmd
- \edef\temp@cmd{\noexpand\addplot[red,thick,\opt@plot]}%
+ \edef\temp@cmd{\noexpand\addplot[thick,\opt@plot]}%
\if@pgfarg
\temp@cmd ( {\func@ph} , {\func@mag} );
\else
@@ -626,7 +650,7 @@
samples=500,
\opt@axes]}
\temp@cmd
- \edef\temp@cmd{\noexpand\addplot[red,thick,\opt@plot]}%
+ \edef\temp@cmd{\noexpand\addplot[thick,\opt@plot]}%
\if@pgfarg
\temp@cmd ( {\func@ph} , {\func@mag} );
\else