\documentclass[border=4pt]{standalone}
\usepackage{ga}
\input{../ee1.tikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to[american voltage source, l=$V_\mathrm{in}$, invert] (0,1.6) to[C, l=$C_1$] (2,1.6) -- (3,1.6) node[ocirc]{};
\draw (2,0) node[circ]{} to[empty diode, l=$D_1$] (2,1.6) node[circ]{};
\draw (0,0) -- (3,0) node[ocirc]{};
\node at (3.6,0.8) {$V_\mathrm{out}$};
% ideal diode: V_out = V_in until it goes negative, 0 down to the trough, then V_in + V_0
\begin{axis}[sketch, at={(4.8cm,-1.6cm)}, width=7.4cm, height=5.4cm, xmin=0, xmax=1.6, ymin=-1.2, ymax=2.3, xlabel={$t$}, ytick={2,-1}, yticklabels={$2V_0$,$-V_0$}, yticklabel style={font=\small}]
  \addplot[black, line width=0.8pt, domain=0:1.5, samples=200] {sin(deg(2*pi*x))};
  \addplot[line width=1.4pt, domain=0:1.5, samples=300] {x<0.5 ? sin(deg(2*pi*x)) : (x<0.75 ? 0 : sin(deg(2*pi*x))+1)};
  \node[font=\small, anchor=west] at (axis cs:0.38,0.6) {$V_\mathrm{in}$}; 
  \coordinate (a1) at (axis cs:0.12,0.55); \coordinate (a2) at (axis cs:0.62,0.03);
\end{axis}
\begin{scope}[shift={(0.4,-3.6)}]
\draw (0,0) to[american voltage source, l=$V_\mathrm{in}$, invert] (0,1.6) to[C] (2,1.6) node[ocirc]{};
\draw (0,0) -- (2,0) node[ocirc]{};
\end{scope}
\begin{scope}[shift={(4.4,-3.6)}]
\draw (0,0) to[american voltage source, l=$V_\mathrm{in}$, invert] (0,1.6) to[C] (2,1.6) -- (2.8,1.6) node[ocirc]{};
\draw (2,1.6) node[circ]{} -- (2,0) node[circ]{};
\draw (0,0) -- (2.8,0) node[ocirc]{};
\end{scope}
\draw[note, ->] (1.4,-1.7) to[bend left=20] (a1);
\draw[note, ->] (5.6,-1.7) to[bend left=20] (a2);
\end{circuitikz}
\end{document}
