另一个额外的 },或忘记了 \endgroup。TIKZ ifthenelse

另一个额外的 },或忘记了 \endgroup。TIKZ ifthenelse

我正在尝试绘制一些有关透析器中的质量转移(Eq2)和导数(Eq1)的等式。必须根据情况绘制,因为如果 b=d,它趋向于 x/0。如您在提供的图片中看到的那样,这对于其他情况来说效果很好。

如果我正确使用 Google 搜索的话,使用 EQ2 时我收到一个错误! Extra }, or forgotten \endgroup.,该错误似乎与我自己的错误无关。

有什么想法可以让我克服这个问题吗?

在此处输入图片描述 问候

梅威瑟:

  \documentclass[11pt,oneside,a4paper]{article}
   \usepackage[T1]{fontenc}

    \usepackage{lipsum} 

\usepackage{tikz}

\usepackage{pgfplots}
\usetikzlibrary{backgrounds}
\usepackage{amsmath}
\pgfplotsset{width=7.5cm,compat=newest,
       }%compat ist die versionsnummer
       \usepgfplotslibrary{external} %rendert, speichert, laedt und spart so zeit
\tikzexternalize

\begin{document}

\begin{equation}
\begin{split}
& \frac{\partial K(QB,QD,KoA)}{\partial QB}= \\ & \begin{cases} \frac{(de^{k/b}(dbe^{k/b}+(k-d)e^{k/d}b-dke^{k/d}))}{(b(de^{k/b}-e^{k/d}b)^2)} &\forall ~QB \neq QD\\\
k^2/(2(d + k)^2)&\forall ~QB= QD\
\end{cases}
\end{split}
\label{e:dkdqb}
\end{equation}
with:
\begin{equation}
K_{Diffusion} =\begin{cases} QB \frac{e^{\frac{koA}{QB}-\frac{KoA}{QD}}-1}{e^{\frac{koA}{QB}- \frac{KoA}{QD}}-\frac{QB}{QD}} 
\quad & \forall \frac{QB}{QD} \neq 1 \\
 \frac{KoA}{\frac{KoA}{QB}+1} 
 \quad & \forall \frac{QB}{QD} = 1\end{cases}\label{e:k}
\end{equation}

\begin{figure}
\begin{tikzpicture}[show background rectangle,tight background,
declare function={
kqb(\b,\d,\k)=ifthenelse(
\b==\d,%
(\k^2/(2(\d+\k)^2)),%
((\d*exp(\k/\b)*(\d*\b*exp(\k/\b)+(\k-\d)*exp(\k/\d)*\b-\d*\k*exp(\k/\d)))/
(\b*(\d*exp(\k/\b)-exp(\k/\d)*\b)^2))
);
kqb2(\b,\d,\k)=((\d*exp(\k/\b)*(\d*\b*exp(\k/\b)+(\k-\d)*exp(\k/\d)*\b-\d*
\k*exp(\k/\d)))/(\b*(\d*exp(\k/\b)-exp(\k/\d)*\b)^2))
);
},
]
\begin{axis}[
width=0.475\textwidth,
       height=0.475\textwidth,
%    title={nummer1}, 
    xlabel=$QB$, ylabel=$KoA$,
%     zlabel=$\frac{\partial k}{\partial QD}$,
    xtick={100,200,300,400,500},
%        ytick={200,500,1000},
%             zlabel style={yshift=-0.25cm}, 
     xlabel style={yshift=0.2cm},
          ylabel style={yshift=.75cm,xshift=-.375cm },
%                   ztick={0,0.5,1},
          x dir=reverse,
          grid=major,
%         view={0}{90},
minor tick num=4,
%colormap,
%colorbar=blackwhite
]
\addplot3[
surf, 
domain=500:100,
    domain y=300:1500,    
%        contour gnuplot={
%        number=10,
%        levels={0.01,0.025,0.05,0.1,0.2,0.3,0.4,0.5,0.6},
%        labels={true}},
%        thick,
        samples=45,samples y=45,
    ] 
%    {(kk2(x,1000,y))};  
%        {(kqb2(x,1000,y))}; 
             {(kqb(x,1000,y))};    
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}[show background rectangle,tight background,
declare function={
kk2(\b,\d,\k)=ifthenelse(\b==\d,%
(\d^2/(\d+\k)^2),%
(((\d-\b)^2*exp(\k/\d+\k/\b))/(\b*exp(\k/\d)-\d*exp(\k/\b))^2));
},
]
\begin{axis}[
width=0.475\textwidth,
       height=0.475\textwidth,
%    title={nummer1}, 
    xlabel=$QB$, ylabel=$KoA$,
%     zlabel=$\frac{\partial k}{\partial QD}$,
    xtick={100,200,300,400,500},
%        ytick={200,500,1000},
%             zlabel style={yshift=-0.25cm}, 
     xlabel style={yshift=0.2cm},
          ylabel style={yshift=.75cm,xshift=-.375cm },
%                   ztick={0,0.5,1},
          x dir=reverse,
          grid=major,
%         view={0}{90},
minor tick num=4,
%colormap,
%colorbar=blackwhite
]
\addplot3[
surf, 
domain=500:100,
    domain y=300:1500,    
%        contour gnuplot={
%        number=10,
%        levels={0.01,0.025,0.05,0.1,0.2,0.3,0.4,0.5,0.6},
%        labels={true}},
%        thick,
        samples=45,samples y=45,
    ] 
    {(kk2(x,1000,y))};  
%        {(kqb(x,1000,y))}; 
%             {(kqb(x,1000,y))};    
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[show background rectangle,tight background,
declare function={
kqb2(\b,\d,\k)=((\d*exp(\k/\b)*(\d*\b*exp(\k/\b)+(\k-\d)*exp(\k/\d)*\b-\d*
\k*exp(\k/\d)))/(\b*(\d*exp(\k/\b)-exp(\k/\d)*\b)^2)));
},
]
\begin{axis}[
width=0.475\textwidth,
       height=0.475\textwidth,
%    title={nummer1}, 
    xlabel=$QB$, ylabel=$KoA$,
%     zlabel=$\frac{\partial k}{\partial QD}$,
    xtick={100,200,300,400,500},
%        ytick={200,500,1000},
%             zlabel style={yshift=-0.25cm}, 
     xlabel style={yshift=0.2cm},
          ylabel style={yshift=.75cm,xshift=-.375cm },
%                   ztick={0,0.5,1},
          x dir=reverse,
          grid=major,
%         view={0}{90},
minor tick num=4,
%colormap,
%colorbar=blackwhite
]
\addplot3[
surf, 
domain=500:100,
    domain y=300:1500,    
%        contour gnuplot={
%        number=10,
%        levels={0.01,0.025,0.05,0.1,0.2,0.3,0.4,0.5,0.6},
%        labels={true}},
%        thick,
        samples=45,samples y=45,
    ] 
%    {(kk2(x,1000,y))};  
        {(kqb2(x,1000,y))}; 
%             {(kqb(x,1000,y))};    
\end{axis}
\end{tikzpicture}
\end{figure}


\end{document}

答案1

正如 @muzimuzhi 指出的那样,只是缺少了一个 *

kqb(\b,\d,\k)=ifthenelse(\b==\d,(\k^2/(2 (\d+\k)^2)),) 中缺少一个 *。

相关内容