# Draw a hysteresis stain-stress Loop

I would like to draw a strain-stress hysteresis Loop, something that looks similar to the picture below?

So far I only found this code here:

\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[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}


this example is more in line with magnetic theory than with material science one. My other way is:

\pgfplotstableread{DataA.dat}{\A}
\begin{tikzpicture}[scale=1.0]
\centering
\begin{axis}[
width=0.65\textwidth,
xlabel={$\varepsilon$  $\left[\SI{}{-}\right]$},
ylabel={$\sigma$ $\left[\SI{}{\newton\per\meter\squared}\right]$},
xmin=-0.005, xmax=0.065 ,
ymin=0, ymax=500000000,
%xtick distance=2000,
%ytick distance=5,
ymajorgrids=true,
xmajorgrids=true,
grid style=dashed,
legend pos=north west,
%title={Fehler der numersichen Berechnung der Impulsbilanz}
]
\addplot [dashdotted, red, mark=square*] table [x={epsilon}, y={sigma}] {\A};
\addplot [dashed, blue, mark=triangle*] table [x={epsilon}, y={sigma}] {\M};
\end{axis}
\end{tikzpicture}


IFor the last solution I have to use my data file which way to big for my latex folder. In conclusion, the first way is better but it needs adjustment and here I hope you can help me with it.

Any help is greatly appreciated.

• Welcome to TeX-SE! What precisely is your question here? I see that you can plot a function, and also see that the output of your first code is a bit different from the function you show on the screen shot. Is your question to find functions that reproduce it more precisely? – user121799 Jul 3 '19 at 16:03
• Yes, precisely that. – sulphur Jul 3 '19 at 16:25

If you do not know the function, you can just draw some curves that resemble the screen shot you want to reproduce. (Of course you could also draw e.g. two rotated Gaussians.)

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (-4,0) -- (4,0) node[above right]{$\varepsilon$};
\draw (0,-3) -- (0,5) node[above left]{$\sigma$};
\draw[very thick,blue] (-4,-4) to (-2.5,0) to[out=70,in=-155]
(-1,2.5) to[out=25,in=-160] (4,4) to[out=-110,in=70] (2.5,0)
to[out=-110,in=25] (1,-2.5) to  cycle;
\draw[latex-latex] (-4.1,-3) -- (-4.1,3) node[midway,left] {$\Delta\sigma$};
\draw[dashed] (-2.5,-0.1) -- (-2.5,-4.5) (2.5,-0.1) -- (2.5,-4.5)
(-4,-4.1) -- (-4,-5) (4,0) -- (4,-5);
\draw[latex-latex] (-4,-4.7) -- (4,-4.7) node[midway,below] {$\Delta\varepsilon$};
\draw[latex-latex] (-4,-4.3) -- (-2.5,-4.3) node[midway,above]  {$\Delta\varepsilon_\tau/2$};
\draw[latex-latex] (4,-4.3) -- (2.5,-4.3) node[midway,above]  {$\Delta\varepsilon_\tau/2$};
\draw[latex-latex] (-2.5,-4.3) -- (2.5,-4.3) node[midway,above]  {$\Delta\varepsilon_F/2$};
\end{tikzpicture}
\end{document}


• Thank you very much. For a hysterese, you always need a material model, some easier some are very complicated. So again your solution looks perfect for me. – sulphur Jul 4 '19 at 21:39

For the required particular shape of the hysteresis loop, I can suggest using the hybrid classical whiskerless hysteresis loop (see “An improved parametric model for hysteresis loop approximation”, R. V. Lapshin, Review of Scientific Instruments, vol. 91, iss. 6, no. 065106, 31 pp., 2020, DOI: 10.1063/5.0012931).

[ Hybrid classical whiskerless hysteresis loops with specified slope β = π/2–θ, gain/attenuation γ, and curvature κ. (a) Various gains γ for fixed β and κ and (b) various curvatures κ for fixed β and γ. The loops are built on trapezoidal pulses.