答案1
您可以使用像 S 型函数这样的函数来绘制漂亮的磁滞回线。下面是使用 PGFPlots 的示例。
代码
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}[very thick,
samples = 100,
xlabel = H,
ylabel = B,
xmin = -7,
xmax = 7,
ymin = -4,
ymax = 4,
axis x line = middle,
axis y line = middle,
ticks = none]
\addplot[dashed] plot (\x, 2.5);
\addplot[dashed] plot (\x,-2.5);
\addplot[red, name path=A] plot (\x, {5/(1 + exp(-1.7*\x+1.5))-2.5});
\addplot[red, name path=B] plot (\x, {5/(1 + exp(-1.7*\x-1.5))-2.5});
\addplot[red!20] fill between[of=A and B];
\end{axis}
\end{tikzpicture}
\end{document}
如果您有真实的磁滞回线数据,您可以使用 PGFPlots 轻松绘制它。
结果
答案2
单程:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=orange!70] (-3,-3) to [out=0,in=200,looseness=1.1] (3,3) to[out=180, in =20,looseness=1.1]
(-3,-3);
\draw[-latex] (-4,0) -- (4,0)node[below]{$H$};
\draw[-latex] (0,-4) -- (0,4)node[left]{$B$};
\draw[dashed] (-4,3) -- (4,3);
\draw[dashed] (-4,-3) -- (4,-3);
\end{tikzpicture}
\end{document}
另一种方法(使用巴塞尔曲线)
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=orange!70] (-3,-3) .. controls (2.5,-3) and (-0.5,3) .. (3,3)
.. controls (-2.5,3) and (0.5,-3) ..(-3,-3);
\draw[-latex] (-4,0) -- (4,0)node[below]{$H$};
\draw[-latex] (0,-4) -- (0,4)node[left]{$B$};
\draw[dashed] (-4,3) -- (4,3);
\draw[dashed] (-4,-3) -- (4,-3);
\end{tikzpicture}
\end{document}
答案3
我对 @Osjerick 脚本进行了一些修改,以适应电流实验产生的磁滞回线的情况。我们从零磁化和无电流开始(我还用电流 I 和磁化 M 改变了 H 和 B。只是一种不同的选择)。然后在一个方向上添加电流,我们得到一个遵循初始路径的磁化(红色)。关闭此电流以达到 0 电流和一些磁化 M 后,电流与饱和点相反(左下角),然后关闭,然后再次回到“正向”方向。我还添加了箭头来指向路径的历史发展,改变了颜色并拉伸了 x 轴。
\begin{tikzpicture}[xscale=2.0]
\draw[fill=green!70,-latex, line width=1] (-3,-3) to [out=0,in=200,looseness=1.1] (3,3)
to[out=180, in =20,looseness=1.1] (-3,-3);
\draw[color=red,-latex, line width=1, dotted] (0,0) to
[out=60,in=180,looseness=0.9] (3,3) ;
\draw[-latex] (-4,0) -- (4,0)node[below]{$I$};
\draw[-latex] (0,-4) -- (0,4)node[left]{$M$};
\draw[dashed] (-4,3) -- (4,3);
\draw[dashed] (-4,-3) -- (4,-3);
\end{tikzpicture}