summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-20 20:20:21 +0000
committerKarl Berry <karl@freefriends.org>2022-07-20 20:20:21 +0000
commit9abe5e7e81cc75e9a63b9bbdffb081bdfc88e1b0 (patch)
treed2520501b8d12efaa8e32a9c6fabe9d34594f881 /Master/texmf-dist/tex/latex
parent4d69fa7122d4258eace9e9886d18f8057a12fe2e (diff)
bodeplot (20jul22)
git-svn-id: svn://tug.org/texlive/trunk@63946 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty243
1 files changed, 137 insertions, 106 deletions
diff --git a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
index 98ae3fdc106..8ffc111abfb 100644
--- a/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
+++ b/Master/texmf-dist/tex/latex/bodeplot/bodeplot.sty
@@ -16,7 +16,6 @@
%% LaTeX version 2006/05/20 or later.
\NeedsTeXFormat{LaTeX2e}[2006/05/20]
\ProvidesPackage{bodeplot}
-\RequirePackage{tikz}
\RequirePackage{pdftexcmds}
\RequirePackage{ifplatform}
\RequirePackage{pgfplots}
@@ -35,15 +34,21 @@
\DeclareOption{declutter}{%
\@declutterargtrue
}
+\newif\if@radarg\@radargfalse
+\DeclareOption{rad}{%
+ \@radargtrue
+}
\ProcessOptions\relax
+\newcommand{\n@mod}[2]{(#1)-(floor((#1)/(#2))*(#2))}
\if@pgfarg
- \newcommand{\n@pow}[2]{(#1)^(#2)}%
- \newcommand{\n@mod}[2]{mod((#1),(#2))}%
+ \newcommand{\n@pow}[2]{(#1)^(#2)}
+ \pgfplotsset{%
+ trig format plots=rad%
+ }
\else
- \newcommand{\n@pow}[2]{(#1)**(#2)}%
- \newcommand{\n@mod}[2]{(#1)-(floor((#1)/(#2))*(#2))}%
- \newcounter{gnuplot@id}%
- \setcounter{gnuplot@id}{0}%
+ \newcommand{\n@pow}[2]{(#1)**(#2)}
+ \newcounter{gnuplot@id}
+ \setcounter{gnuplot@id}{0}
\if@declutterarg
\tikzset{%
gnuplot@prefix/.style={%
@@ -59,16 +64,9 @@
}%
}
\fi
- \pgfplotsset{%
- gnuplot@degrees/.code={%
- \ifnum\value{gnuplot@id}=1
- \xdef\pgfplots@gnuplot@format{\pgfplots@gnuplot@format set angles degrees;}%
- \fi
- }%
- }
\ifwindows\else
\if@declutterarg
- \immediate\write18{mkdir -p gnuplot}%
+ \immediate\write18{mkdir -p gnuplot}
\fi
\fi
\fi
@@ -86,14 +84,21 @@
width=5cm,
}%
}
+\if@radarg
+ \pgfplotsset{ph@filter/.style = {ytick distance=pi/4, ylabel={Phase (rad)}}}%
+ \pgfplotsset{ph@x@filter/.style = {xlabel={Phase (rad)}}}%
+\else
+ \pgfplotsset{ph@filter/.style = {y filter/.expression={y*180/pi}, ytick distance=45, ylabel={Phase (deg)}}}%
+ \pgfplotsset{ph@x@filter/.style = {x filter/.expression={x*180/pi}, xlabel={Phase (deg)}}}%
+\fi
\newcommand*{\MagK}[2]{(20*log10(abs(#1)))}
\newcommand*{\MagKAsymp}{\MagK}
\newcommand*{\MagKLin}{\MagK}
-\newcommand*{\PhK}[2]{(#1<0?-180:0)}
+\newcommand*{\PhK}[2]{(#1<0?-pi:0)}
\newcommand*{\PhKAsymp}{\PhK}
\newcommand*{\PhKLin}{\PhK}
\newcommand*{\MagDel}[2]{0}
-\newcommand*{\PhDel}[2]{-#1*180*t/pi}
+\newcommand*{\PhDel}[2]{-#1*t}
\newcommand*{\MagPole}[2]
{(-20*log10(sqrt(\n@pow{#1}{2} + \n@pow{t - (#2)}{2})))}
\newcommand*{\MagPoleLin}[2]{(t < sqrt(\n@pow{#1}{2} + \n@pow{#2}{2}) ?
@@ -102,25 +107,25 @@
)}
\newcommand*{\MagPoleAsymp}{\MagPoleLin}
\newcommand*{\PhPole}[2]{(#1 > 0 ? (#2 > 0 ?
- (\n@mod{-atan2((t - (#2)),-(#1))+360}{360}) :
+ (\n@mod{-atan2((t - (#2)),-(#1))}{2*pi}) :
(-atan2((t - (#2)),-(#1)))) :
(-atan2((t - (#2)),-(#1))))}
\newcommand*{\PhPoleLin}[2]{%
- (abs(#1)+abs(#2) == 0 ? -90 :
+ (abs(#1)+abs(#2) == 0 ? -pi/2 :
(t < (sqrt(\n@pow{#1}{2} + \n@pow{#2}{2}) /
(\n@pow{10}{sqrt(\n@pow{#1}{2}/(\n@pow{#1}{2} + \n@pow{#2}{2}))})) ?
(-atan2(-(#2),-(#1))) :
(t >= (sqrt(\n@pow{#1}{2} + \n@pow{#2}{2}) *
(\n@pow{10}{sqrt(\n@pow{#1}{2}/(\n@pow{#1}{2} + \n@pow{#2}{2}))})) ?
- (#2>0?(#1>0?270:-90):-90) :
+ (#2>0?(#1>0?3*pi/2:-pi/2):-pi/2) :
(-atan2(-(#2),-(#1)) + (log10(t/(sqrt(\n@pow{#1}{2} + \n@pow{#2}{2}) /
(\n@pow{10}{sqrt(\n@pow{#1}{2}/(\n@pow{#1}{2} +
- \n@pow{#2}{2}))}))))*((#2>0?(#1>0?270:-90):-90) + atan2(-(#2),-(#1)))/
+ \n@pow{#2}{2}))}))))*((#2>0?(#1>0?3*pi/2:-pi/2):-pi/2) + atan2(-(#2),-(#1)))/
(log10(\n@pow{10}{sqrt((4*\n@pow{#1}{2})/
(\n@pow{#1}{2} + \n@pow{#2}{2}))}))))))}
\newcommand*{\PhPoleAsymp}[2]{(t < (sqrt(\n@pow{#1}{2} + \n@pow{#2}{2})) ?
(-atan2(-(#2),-(#1))) :
- (#2>0?(#1>0?270:-90):-90))}
+ (#2>0?(#1>0?3*pi/2:-pi/2):-pi/2))}
\newcommand*{\MagZero}{0-\MagPole}
\newcommand*{\MagZeroLin}{0-\MagPoleLin}
\newcommand*{\MagZeroAsymp}{0-\MagPoleAsymp}
@@ -136,10 +141,10 @@
\newcommand*{\PhCSPolesLin}[2]{(t < (#2 / (\n@pow{10}{abs(#1)})) ?
0 :
(t >= (#2 * (\n@pow{10}{abs(#1)})) ?
- (#1>0 ? -180 : 180) :
- (#1>0 ? (-180*(log10(t*(\n@pow{10}{#1})/#2))/(2*#1)) :
- (180*(log10(t*(\n@pow{10}{abs(#1)})/#2))/(2*abs(#1))))))}
-\newcommand*{\PhCSPolesAsymp}[2]{(#1>0?(t<#2?0:-180):(t<#2?0:180))}
+ (#1>0 ? -pi : pi) :
+ (#1>0 ? (-pi*(log10(t*(\n@pow{10}{#1})/#2))/(2*#1)) :
+ (pi*(log10(t*(\n@pow{10}{abs(#1)})/#2))/(2*abs(#1))))))}
+\newcommand*{\PhCSPolesAsymp}[2]{(#1>0?(t<#2?0:-pi):(t<#2?0:pi))}
\newcommand*{\MagCSZeros}{0-\MagCSPoles}
\newcommand*{\MagCSZerosLin}{0-\MagCSPolesLin}
\newcommand*{\MagCSZerosAsymp}{0-\MagCSPolesAsymp}
@@ -162,10 +167,10 @@
\newcommand*{\PhSOPoles}[2]{(-atan2((#1)*t,((#2) - \n@pow{t}{2})))}
\newcommand*{\PhSOPolesLin}[2]{(#2>0 ?
\PhCSPolesLin{(#1/(2*sqrt(#2)))}{(sqrt(#2))} :
- (#1>0 ? -180 : 180))}
+ (#1>0 ? -pi : pi))}
\newcommand*{\PhSOPolesAsymp}[2]{(#2>0 ?
\PhCSPolesAsymp{(#1/(2*sqrt(#2)))}{(sqrt(#2))} :
- (#1>0 ? -180 : 180))}
+ (#1>0 ? -pi : pi))}
\newcommand*{\MagSOZeros}{0-\MagSOPoles}
\newcommand*{\MagSOZerosLin}{0-\MagSOPolesLin}
\newcommand*{\MagSOZerosAsymp}{0-\MagSOPolesAsymp}
@@ -187,7 +192,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{\opt@approx}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{groupplot}[%
bode@style,
xmin={#3},
@@ -200,31 +205,18 @@
]%
}%
\temp@cmd
- \if@pgfarg
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[variable=t,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[variable=t,thick,\optph@plot]}%
- \temp@cmd {\func@ph};
- \optph@commands
- \else
- \stepcounter{gnuplot@id}
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[variable=t,thick,\optmag@plot]}%
- \temp@cmd gnuplot[gnuplot@degrees,gnuplot@prefix] {\func@mag};
+ \edef\temp@mag@cmd{\noexpand\nextgroupplot[ytick distance=20, ylabel={Gain (dB)}, xmajorticks=false, \optmag@axes]
+ \noexpand\addplot[variable=t, thick, \optmag@plot]}
+ \edef\temp@ph@cmd{\noexpand\nextgroupplot[ph@filter, xlabel={Frequency (rad/s)}, \optph@axes]
+ \noexpand\addplot[variable=t, thick, \optph@plot]}
+ \if@pgfarg\else
+ \edef\temp@mag@cmd{\noexpand\stepcounter{gnuplot@id} \unexpanded\expandafter{\temp@mag@cmd} gnuplot[gnuplot@prefix]}
+ \edef\temp@ph@cmd{\noexpand\stepcounter{gnuplot@id} \unexpanded\expandafter{\temp@ph@cmd} gnuplot[gnuplot@prefix]}
+ \fi
+ \temp@mag@cmd {\func@mag};
\optmag@commands
- \stepcounter{gnuplot@id}
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[variable=t,thick,\optph@plot]}%
- \temp@cmd gnuplot[gnuplot@degrees,gnuplot@prefix] {\func@ph};
+ \temp@ph@cmd {\func@ph};
\optph@commands
- \fi
\end{groupplot}
\end{tikzpicture}
}
@@ -233,7 +225,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{groupplot}[%
bode@style,
xmin={#3},
@@ -246,31 +238,22 @@
]%
}%
\temp@cmd
+ \edef\temp@mag@cmd{\noexpand\nextgroupplot[ytick distance=20, ylabel={Gain (dB)}, xmajorticks=false, \optmag@axes]
+ \noexpand\addplot[variable=t, thick, \optmag@plot]}
+ \edef\temp@ph@cmd{\noexpand\nextgroupplot[ph@filter, xlabel={Frequency (rad/s)}, \optph@axes]
+ \noexpand\addplot[variable=t, thick, \optph@plot]}
+ \if@pgfarg\else
+ \edef\temp@mag@cmd{\noexpand\stepcounter{gnuplot@id} \unexpanded\expandafter{\temp@mag@cmd} gnuplot[gnuplot@prefix]}
+ \edef\temp@ph@cmd{\noexpand\stepcounter{gnuplot@id} \unexpanded\expandafter{\temp@ph@cmd} gnuplot[gnuplot@prefix]}
+ \fi
+ \temp@mag@cmd {\func@mag};
+ \optmag@commands
\if@pgfarg
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[variable=t,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[variable=t,thick,\optph@plot]}%
- \temp@cmd {\func@ph};
- \optph@commands
+ \temp@ph@cmd {\n@mod{\func@ph}{2*pi}};
\else
- \stepcounter{gnuplot@id}%
- \expandafter\nextgroupplot\expandafter[ytick distance=20,
- ylabel={Gain (dB)},xmajorticks=false,\optmag@axes]
- \edef\temp@cmd{\noexpand\addplot[variable=t,thick,\optmag@plot]}%
- \temp@cmd gnuplot[gnuplot@degrees,gnuplot@prefix] {\func@mag};
- \optmag@commands
- \stepcounter{gnuplot@id}%
- \expandafter\nextgroupplot\expandafter[ytick distance=45,
- ylabel={Phase ($^{\circ}$)},xlabel={Frequency (rad/s)},\optph@axes]
- \edef\temp@cmd{\noexpand\addplot[variable=t,thick,\optph@plot]}%
- \temp@cmd gnuplot[gnuplot@degrees,gnuplot@prefix] {\func@ph};
- \optph@commands
+ \temp@ph@cmd {'+' using (t):\func@ph smooth unwrap};
\fi
+ \optph@commands
\end{groupplot}
\end{tikzpicture}
}
@@ -289,7 +272,7 @@
\else
\stepcounter{gnuplot@id}%
\edef\temp@cmd{\noexpand\addplot[variable=t,thick,\opt]}
- \temp@cmd gnuplot[gnuplot@degrees,gnuplot@prefix] {\plot@macro};
+ \temp@cmd gnuplot[gnuplot@prefix] {\plot@macro};
\fi
}%
}
@@ -302,10 +285,18 @@
\build@TF@plot{\plot@macro}{\temp@macro}{#3}%
\fi
\if@pgfarg
- \addplot[variable=t,#1]{\plot@macro};
+ \ifnum\pdfstrcmp{#2}{phase}=0
+ \addplot[variable=t,#1]{\n@mod{\plot@macro}{2*pi}};
+ \else
+ \addplot[variable=t,#1]{\plot@macro};
+ \fi
\else
\stepcounter{gnuplot@id}%
- \addplot[variable=t,#1] gnuplot[gnuplot@degrees, gnuplot@prefix] {\plot@macro};
+ \ifnum\pdfstrcmp{#2}{phase}=0
+ \addplot[variable=t,#1] gnuplot[gnuplot@prefix] {'+' using (t):\plot@macro smooth unwrap}
+ \else
+ \addplot[variable=t,#1] gnuplot[gnuplot@prefix] {\plot@macro};
+ \fi
\fi
}
\newcommand{\addBodeComponentPlot}[2][thick]{%
@@ -313,12 +304,52 @@
\addplot[variable=t,#1]{#2};
\else
\stepcounter{gnuplot@id}%
- \addplot[variable=t,#1] gnuplot[gnuplot@degrees,gnuplot@prefix] {#2};
+ \addplot[variable=t,#1] gnuplot[gnuplot@prefix] {#2};
\fi
}
+\newenvironment{BodePhPlot}[3][]{%
+ \parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]
+ \noexpand\begin{semilogxaxis}[%
+ ph@filter,
+ bode@style,
+ xmin={#2},
+ xmax={#3},
+ domain=#2:#3,
+ height=2.5cm,
+ xlabel={Frequency (rad/s)},
+ \unexpanded\expandafter{\opt@axes}
+ ]%
+ }
+ \temp@cmd
+}{
+ \end{semilogxaxis}
+ \end{tikzpicture}
+}
+\newenvironment{BodeMagPlot}[3][]{%
+ \parse@env@opt{#1}%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]
+ \noexpand\begin{semilogxaxis}[%
+ bode@style,
+ xmin={#2},
+ xmax={#3},
+ domain=#2:#3,
+ height=2.5cm,
+ xlabel={Frequency (rad/s)},
+ ylabel={Gain (dB)},
+ ytick distance=40,
+ \unexpanded\expandafter{\opt@axes}
+ ]%
+ }
+ \temp@cmd
+}{
+ \end{semilogxaxis}
+ \end{tikzpicture}
+}
\newenvironment{BodePlot}[3][]{%
+ \PackageWarning{bodeplot}{Since v1.1.0, the BodePlot environment returns phase plots in radian units only. Please use the BodePhPlot environment if degree units are needed.}%
\parse@env@opt{#1}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]
\noexpand\begin{semilogxaxis}[%
bode@style,
xmin={#2},
@@ -328,7 +359,7 @@
xlabel={Frequency (rad/s)},
\unexpanded\expandafter{\opt@axes}
]%
- }%
+ }
\temp@cmd
}{
\end{semilogxaxis}
@@ -464,8 +495,8 @@
\xdef\loop@delay{\values}%
\fi
}%
- \xdef#2{(\n@mod{atan2((\num@im),(\num@real))-atan2((\den@im),%
- (\den@real))-\loop@delay*180*t/pi+360}{360})}%
+ \xdef#2{(atan2((\num@im),(\num@real))-atan2((\den@im),%
+ (\den@real))-\loop@delay*t)}%
\xdef#1{(20*log10(sqrt((\n@pow{\num@real}{2})+(\n@pow{\num@im}{2})))-%
20*log10(sqrt((\n@pow{\den@real}{2})+(\n@pow{\den@im}{2}))))}%
}
@@ -553,7 +584,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bode@style,
domain=#3:#4,
@@ -566,14 +597,14 @@
}%
\temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
- \edef\temp@cmd{\noexpand\addplot[variable=t,thick,\unexpanded\expandafter{\opt@plot}]}%
+ \edef\temp@cmd{\noexpand\addplot[variable=t, 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{gnuplot@id}%
- \temp@cmd gnuplot[parametric,gnuplot@degrees,gnuplot@prefix] {%
+ \temp@cmd gnuplot[parametric,gnuplot@prefix] {%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
\opt@commands
@@ -586,7 +617,7 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bode@style,
domain=#3:#4,
@@ -599,14 +630,14 @@
}%
\temp@cmd
\addplot [only marks,mark=+,thick,red] (-1 , 0);
- \edef\temp@cmd{\noexpand\addplot[variable=t,thick,\unexpanded\expandafter{\opt@plot}]}%
+ \edef\temp@cmd{\noexpand\addplot[variable=t, 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{gnuplot@id}%
- \temp@cmd gnuplot[parametric,gnuplot@degrees,gnuplot@prefix]{%
+ \temp@cmd gnuplot[parametric,gnuplot@prefix]{%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
\opt@commands
@@ -623,7 +654,7 @@
{\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)} );
\else
\stepcounter{gnuplot@id}%
- \addplot[variable=t,#1] gnuplot[parametric,gnuplot@degrees,gnuplot@prefix]{%
+ \addplot[variable=t,#1] gnuplot[parametric,gnuplot@prefix]{%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
\fi
@@ -637,14 +668,14 @@
{\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)} );
\else
\stepcounter{gnuplot@id}%
- \addplot[variable=t,#1] gnuplot[parametric,gnuplot@degrees,gnuplot@prefix]{%
+ \addplot[variable=t,#1] gnuplot[parametric,gnuplot@prefix]{%
\n@pow{10}{((\func@mag)/20)}*cos(\func@ph),
\n@pow{10}{((\func@mag)/20)}*sin(\func@ph)};
\fi
}
\newenvironment{NyquistPlot}[3][]{%
\parse@env@opt{#1}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
bode@style,
height=5cm,
@@ -691,12 +722,12 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@ZPK@plot{\func@mag}{\func@ph}{}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
+ ph@x@filter,
bode@style,
domain=#3:#4,
height=5cm,
- xlabel={Phase (degrees)},
ylabel={Gain (dB)},
samples=500,
\unexpanded\expandafter{\opt@axes}
@@ -709,7 +740,7 @@
\opt@commands
\else
\stepcounter{gnuplot@id}%
- \temp@cmd gnuplot[parametric, gnuplot@degrees, gnuplot@prefix]
+ \temp@cmd gnuplot[parametric,gnuplot@prefix]
{ \func@ph , \func@mag };
\opt@commands
\fi
@@ -721,12 +752,12 @@
\gdef\func@mag{}%
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
+ ph@x@filter,
bode@style,
domain=#3:#4,
height=5cm,
- xlabel={Phase (degrees)},
ylabel={Gain (dB)},
samples=500,
\unexpanded\expandafter{\opt@axes}
@@ -735,12 +766,12 @@
\temp@cmd
\edef\temp@cmd{\noexpand\addplot[variable=t,thick,\opt@plot]}%
\if@pgfarg
- \temp@cmd ( {\func@ph} , {\func@mag} );
+ \temp@cmd ( {\n@mod{\func@ph}{2*pi}} , {\func@mag} );
\opt@commands
\else
\stepcounter{gnuplot@id}%
- \temp@cmd gnuplot[parametric, gnuplot@degrees, gnuplot@prefix]
- { \func@ph , \func@mag };
+ \temp@cmd gnuplot[parametric,gnuplot@prefix]
+ { \n@mod{\func@ph}{2*pi} , \func@mag };
\opt@commands
\fi
\end{axis}
@@ -748,12 +779,12 @@
}
\newenvironment{NicholsChart}[3][]{%
\parse@env@opt{#1}%
- \edef\temp@cmd{\noexpand\begin{tikzpicture}[\unexpanded\expandafter{\opt@tikz}]%
+ \edef\temp@cmd{\noexpand\begin{tikzpicture} [\unexpanded\expandafter{\opt@tikz}]%
\noexpand\begin{axis}[%
+ ph@x@filter,
bode@style,
domain=#2:#3,
height=5cm,
- xlabel={Phase (degrees)},
ylabel={Gain (dB)},
\unexpanded\expandafter{\opt@axes}
]%
@@ -771,7 +802,7 @@
\addplot[variable=t,#1] ( {\func@ph} , {\func@mag} );
\else
\stepcounter{gnuplot@id}%
- \addplot[variable=t,#1] gnuplot[parametric,gnuplot@degrees,gnuplot@prefix]
+ \addplot[variable=t,#1] gnuplot[parametric,gnuplot@prefix]
{\func@ph , \func@mag};
\fi
}
@@ -780,11 +811,11 @@
\gdef\func@ph{}%
\build@TF@plot{\func@mag}{\func@ph}{#2}%
\if@pgfarg
- \addplot[variable=t,#1] ( {\func@ph} , {\func@mag} );
+ \addplot[variable=t,#1] ( {\n@mod{\func@ph}{2*pi}} , {\func@mag} );
\else
\stepcounter{gnuplot@id}%
- \addplot[variable=t,#1] gnuplot[gnuplot@degrees,gnuplot@prefix]
- {\func@ph , \func@mag};
+ \addplot[variable=t,#1] gnuplot[gnuplot@prefix]
+ {\n@mod{\func@ph}{2*pi} , \func@mag};
\fi
}
\endinput