
Desculpe pelo meu inglês incorreto.
Eu modifiquei o código deaquipara adaptá-lo para o TikZ datavisualization
. Aqui está o código adaptado:
\documentclass{scrartcl}
\usepackage{tikz}
\usepackage[per-mode = fraction]{siunitx}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}
\begin{tikzpicture}
\datavisualization[
scientific axes = {clean, end labels},
all axes = {ticks and grid = {major at = 0}},
x axis = {label = $\frac{H}{\si{\A\per\m}}$},
y axis = {label = $\frac{B(H)}{\si{\tesla}}$},
data/format = function,
visualize as smooth line/.list = {left, right}
]
data[set = left] {
var x : interval [-7 : 7];
func y = 5 / (1 + exp(-1.7 * \value x - 1.5)) - 2.5;
}
data[set = right] {
var x : interval [-7 : 7];
func y = 5 / (1 + exp(-1.7 * \value x + 1.5)) - 2.5;
}
%accents important points
info {
\draw (visualization cs:x = {(-1.5 / 1.7)}, y = 0) circle [radius = 1pt]
node [left, font = \footnotesize] {$H_C$};
}
info {
\draw (visualization cs:x = 0, y = 1.59) circle [radius = 1pt]
node [left, font=\footnotesize] {$B_R$};
}
info {
\draw (visualization cs:x = 7, y = 2.5) circle [radius = 1pt]
node [above, font=\footnotesize] {$B_S$};
};
\end{tikzpicture}
\end{document}
Mas recebo muitos desses erros:
! Dimensão muito grande.
\pgfmath@iterate
...\pgfmath@xa \ifdim \pgfmath@x
Pode-se usar o TikZ fpu
mesmoaqui,aquieaqui. Aqui está o meu código:
\documentclass{scrartcl}
\usepackage{tikz}
\usepackage[per-mode = fraction]{siunitx}
\usetikzlibrary{datavisualization.formats.functions,fpu}
\begin{document}
\begin{tikzpicture}
\datavisualization[
scientific axes = {clean, end labels},
all axes = {ticks and grid = {major at = 0}},
x axis = {label = $\frac{H}{\si{\A\per\m}}$},
y axis = {label = $\frac{B(H)}{\si{\tesla}}$},
data/format = function,
visualize as smooth line/.list = {left, right}
]
data[set = left] {
var x : interval [-7 : 7];
\pgfkey{/pgf/fpu, /pgf/fpu/output format=fixed}
func y = 5 / (1 + exp(-1.7 * \value x - 1.5)) - 2.5;
\pgfkeys{/pgf/fpu=false}
}
data[set = right] {
var x : interval [-7 : 7];
\pgfkey{/pgf/fpu, /pgf/fpu/output format=fixed}
func y = 5 / (1 + exp(-1.7 * \value x + 1.5)) - 2.5;
\pgfkeys{/pgf/fpu=false}
}
%accents important points
info {
\draw (visualization cs:x = {(-1.5 / 1.7)}, y = 0) circle [radius = 1pt]
node [left, font = \footnotesize] {$H_C$};
}
info {
\draw (visualization cs:x = 0, y = 1.59) circle [radius = 1pt]
node [left, font=\footnotesize] {$B_R$};
}
info {
\draw (visualization cs:x = 7, y = 2.5) circle [radius = 1pt]
node [above, font=\footnotesize] {$B_S$};
};
\end{tikzpicture}
\end{document}
Mas meu pdfLaTeX
compilador TeXnicCenter
entra em um loop infinito. O que eu estou errado?
A propósito: As linhas de decoração acima já parecem iguais (apenas alterações de coordenadas, alinhamento e texto). Existe uma maneira de combiná-lo/otimizá-lo.
Obrigado por sua ajuda com antecedência!
Responder1
Parece que quando o valor x se torna um número negativo “grande”, ele quebra. Se você alterar o limite inferior da left
curva para -6,5 e a right
curva para -4,5, a compilação será correta aqui.
\documentclass{scrartcl}
\usepackage{tikz}
\usepackage[per-mode = fraction]{siunitx}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}
\begin{tikzpicture}
\datavisualization[
scientific axes = {clean, end labels},
all axes = {ticks and grid = {major at = 0}},
x axis = {label = $\frac{H}{\si{\A\per\m}}$},
y axis = {label = $\frac{B(H)}{\si{\tesla}}$},
data/format = function,
visualize as smooth line/.list = {left, right}
]
data[set = left] {
var x : interval [-6.5 : 7];
func y = 5 / (1 + exp(-1.7 * \value x - 1.5)) - 2.5;
}
data[set = right] {
var x : interval [-4.5 : 7];
func y = 5 / (1 + exp(-1.7 * \value x + 1.5)) - 2.5;
}
%accents important points
info {
\draw (visualization cs:x = {(-1.5 / 1.7)}, y = 0) circle [radius = 1pt]
node [left, font = \footnotesize] {$H_C$};
}
info {
\draw (visualization cs:x = 0, y = 1.59) circle [radius = 1pt]
node [left, font=\footnotesize] {$B_R$};
}
info {
\draw (visualization cs:x = 7, y = 2.5) circle [radius = 1pt]
node [above, font=\footnotesize] {$B_S$};
};
\end{tikzpicture}
\end{document}