Estoy tratando de trazar algunas equiparaciones con respecto a la transferencia de masa en dializadores (Eq2) y los derivados (Eq1). Debe graficarse caso por caso, ya que tiende a x/0 si b=d. Esto funciona bien para otros casos, como puede ver en la imagen proporcionada.
Con EQ2 recibo un error ! Extra }, or forgotten \endgroup.
que parece no estar vinculado a mis propios errores, si busqué en Google correctamente.
¿Alguna idea de cómo puedo superar esto?
MWE:
\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}
Respuesta1
Como señaló @muzimuzhi, simplemente faltaba *
Falta un * en kqb(\b,\d,\k)=ifthenelse(\b==\d,(\k^2/(2 (\d+\k)^2)),).