使用 TIkz/PGF 绘制相线图

使用 TIkz/PGF 绘制相线图

我在使用这两个包之前创建过相位线图。代码如下,

\documentclass{amsart}
\usepackage{pgfplots}
\usepackage{tikz}


\newcommand*{\TickSize}{2pt}%

\newcommand*{\AxisMin}{0}%
\newcommand*{\AxisMax}{0}%

\newcommand*{\DrawHorizontalPhaseLine}[4][]{%
% #1 = axis tick labels
% #2 = right arrows positions as CSV
% #3 = left arrow positions as CSV
\gdef\AxisMin{0}%
\gdef\AxisMax{0}%
\edef\MyList{#2}% Allows for #1 to be both a macro or not
\foreach \X in \MyList {
    \draw  (\X,\TickSize) -- (\X,-\TickSize) node [below] {$\X$};
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#3}% Allows for #2 to be both a macro or not
\foreach \X in \MyList {% Right arrows
    \draw [->] (\X-0.1,0) -- (\X,0);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#4}% Allows for #3 to be both a macro or not
\foreach \X in \MyList {% Left arrows
    \draw [<-] (\X-0.1,0) -- (\X,0);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\draw  (\AxisMin-1,0) -- (\AxisMax+1,0) node [right] {#1};
}%

\newcommand*{\DrawVerticalPhaseLine}[4][]{%
% #1 = axis tick labels
% #2 = up arrows positions as CSV
% #3 = down arrow positions as CSV
\gdef\AxisMin{0}%
\gdef\AxisMax{0}%
\edef\MyList{#2}% Allows for #1 to be both a macro or not
\foreach \X in \MyList {
    \draw  (-\TickSize,\X) -- (\TickSize,\X) node [right] {$\X$};
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#3}% Allows for #2 to be both a macro or not
\foreach \X in \MyList {% Up arrows
    \draw [->] (0,\X-0.1) -- (0,\X);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\edef\MyList{#4}% Allows for #3 to be both a macro or not
\foreach \X in \MyList {% Down arrows
    \draw [<-] (0,\X+0.1) -- (0,\X);
    \ifnum\AxisMin>\X
        \xdef\AxisMin{\X}%
    \fi
    \ifnum\AxisMax<\X
        \xdef\AxisMax{\X}%
    \fi
}

\draw  (0,\AxisMin-1) -- (0,\AxisMax+1) node [above] {#1};
}%
\begin{document}
\begin{tikzpicture}[thick]
\DrawHorizontalPhaseLine[$I$]{-1,0,1,2}{0.25,0.5,0.75} {-0.25,-0.5,-0.75,1.25,1.5,1.75}
\draw[domain=-0.5:1.5,smooth,variable=\x,red] plot ({\x},{-1*(\x-0.5)*  (\x-0.5)+.25});
\end{tikzpicture}
\end{document}

这让我在此处输入图片描述

但是,现在我正在处理一个一般情况,其中我知道 (a-mu)/a >0。我希望抛物线的开口向下,在 0 和 1 处相交,而不是向下开口,在 0 和 (a-mu)/a > 0 处相交。这可能吗?

我用过绘制微分方程的相线作为参考。

相关内容