\documentclass[border=4pt]{standalone}
\usepackage{ga}
\input{../fm.tikz}
\begin{document}
\begin{circuitikz}[font=\small]
\draw (0,0) to[american voltage source, l=$V_\mathrm{in}$, invert] (0,2.6) -- (0.6,2.6);
\draw (1.6,2.6) to[empty diode, l_=$D_1$] (0.6,2.6);
\draw (1.6,2.6) to[battery1, l=$V_\mathrm{B}$] (2.8,2.6) node[circ]{} to[short, -o] (3.8,2.6);
\node[font=\footnotesize] at (2.2,2.0) {2 V};
\draw (2.8,2.6) to[R, l_=$R_1$] (2.8,0);
\draw (0,0) -- (2.8,0) to[short, -o] (3.8,0);
\node at (3.8,2.15) {$+$}; \node at (4.0,1.3) {$V_\mathrm{out}$}; \node at (3.8,0.45) {$-$};
\begin{scope}[xshift=6.6cm, yshift=1.6cm]
\axes{-1.4}{3.0}{-1.6}{1.6}{$V_\mathrm{in}$}{$V_\mathrm{out}$}
\draw[cv] (-0.4,-1.5) -- (1.1,0) -- (2.8,0); \xt{1.1}{} \node[below right, font=\footnotesize] at (1.0,0) {2 V}; \yt{-1.1}{$-2$}
\draw (-0.1,-1.2) -- (0.2,-1.2) -- (0.2,-0.9); \node[left, font=\footnotesize] at (-0.1,-1.25) {1};
\end{scope}
\begin{scope}[yshift=-3.6cm]
\node[right, align=left] at (-1.6,2.0) {$V_\mathrm{in}>2$ V:\\ Diode off};
\node[right] at (4.6,2.4) {$V_\mathrm{in}<2$ V:};
\draw (0.8,0) to[american voltage source, l=$V_\mathrm{in}$, invert] (0.8,2.4) to[short, i=$I$] (1.6,2.4) to[battery1, l={2 V}] (2.6,2.4) node[circ]{} to[short, -o] (3.6,2.4);
\draw (2.6,2.4) to[R, l_=$R_1$] (2.6,0);
\draw (0.8,0) -- (2.6,0) to[short, -o] (3.6,0);
\draw[gaaccent,->] (1.4,1.3) arc[start angle=200, end angle=-20, radius=0.22]; \node[gaaccent, font=\footnotesize] at (1.65,0.8) {KVL};
\node at (3.6,2.0) {$+$}; \node at (3.8,1.2) {$V_\mathrm{out}$}; \node at (3.6,0.4) {$-$};
\node[right] at (4.6,1.6) {KVL: $-V_\mathrm{in} + 2\,\mathrm{V} + V_\mathrm{out} = 0$};
\node[right] at (5.4,0.8) {$V_\mathrm{out} = V_\mathrm{in} - 2\,\mathrm{V}$};
\end{scope}
\end{circuitikz}
\end{document}
