你好,我正在尝试绘制以下 tikz 代码:
\def\tr{0.1}
\def\ts{0.6}
\def\al{1.3}
\def\n{1.6}
\def\I{0.3506}
\def\ti{0.4071}
\def\S{-0.1340}
\def\Sangle{-42}
\def\f1{0.8}
\begin{tikzpicture}[domain=-3:5, xscale=1, yscale=5, >=latex]
\draw[very thin,color=gray!30] (-3,0)
grid[xstep=0.5, ystep=0.1] (5,0.7);
\draw[->, line width=1pt] (-3,0) -- (5.25,0)
node[below] {$\log(\psi)$};
\draw[->, line width=1pt] (-3,0) -- (-3,0.75)
node[left] {$U(\psi)$};
\draw[color=green!30!black, thick, smooth]
plot[id=x, domain=-3:5]
function{\tr+(\ts-\tr)/(1+(\al*exp(x))**\n)**(1-1/\n)};
\node[left] (tr) at (-3,\tr) {$U_r$};
\node[left] (ts) at (-3,\ts) {$U_s$};
\draw[dashed] (\I,0) node[below] {$I$} -- (\I,\ti) -- (-3,\ti)
node[left] {$U_i$};
\draw[color=green!30!black, dashed]
plot[id=x, domain=-1.5:3]
function{\ti+\S*(x-\I)};
\draw[|<->|] (\I,\ti)++(1,0) arc (0:\Sangle:0.8 and 0.15);
\path (\I,\ti)++(0.5*1.5\Sangle/8:1)
node[right=-1pt] {$\tan^{-1}(S)$};
\node[anchor=base] (vg) at (1,0.8)
{$U(\psi) = U_r+\displaystyle\frac{U_s-U_r}{(1+(\alpha\psi)^n)^m}$};
\end{tikzpicture}
但由于某种原因,该函数没有绘制出来,我只得到这个:
有人能告诉我我做错了什么吗?
答案1
是的,很可能你没有安装相关软件(gnuplot?)。但你不需要它,你可以用 Ti 绘制函数钾仅限 Z。
\documentclass[tikz]{standalone}
\def\TR{0.1}
\def\TS{0.6}
\def\al{1.3}
\def\n{1.6}
\def\I{0.3506}
\def\ti{0.4071}
\def\S{-0.1340}
\def\Sangle{-42}
\def\fone{0.8}
\begin{document}
\begin{tikzpicture}[xscale=1, yscale=5, >=latex]
\draw[very thin,color=gray!30] (-3,0)
grid[xstep=0.5, ystep=0.1] (5,0.7);
\draw[->, line width=1pt] (-3,0) -- (5.25,0)
node[below] {$\log(\psi)$};
\draw[->, line width=1pt] (-3,0) -- (-3,0.75)
node[left] {$U(\psi)$};
\draw[color=green!30!black, thick, smooth]
plot[id=x, domain=-3:5]
({\x},{\TR+(\TS-\TR)/(1+(\al*exp(\x))^\n)^(1-1/\n)});
\node[left] (tr) at (-3,\TR) {$U_r$};
\node[left] (ts) at (-3,\TS) {$U_s$};
\draw[dashed] (\I,0) node[below] {$I$} -- (\I,\ti) -- (-3,\ti)
node[left] {$U_i$};
\draw[color=green!30!black, dashed]
plot[id=x, domain=-1.5:3]
({\x},{\ti+\S*(\x-\I)});
\draw[|<->|] (\I,\ti)++(1,0) arc (0:\Sangle:0.8 and 0.15);
\path (\I,\ti)++(0.5*1.5\Sangle/8:1)
node[right=-1pt] {$\tan^{-1}(S)$};
\node[anchor=base] (vg) at (1,0.8)
{$U(\psi) = U_r+\displaystyle\frac{U_s-U_r}{(1+(\alpha\psi)^n)^m}$};
\end{tikzpicture}
\end{document}
\endinput
请注意,我利用这个机会为一些变量赋予了更安全的名称,例如,\tr
因为它代表跟踪,所以非常危险,等等。还请注意,这def\f1{0.8}
可能不是你想要的,LaTeX 不接受宏名称中的数字。