\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.8) to[empty diode, l=$D_1$] (1.8,1.8) -- (2.8,1.8) node[ocirc]{};
\draw (1.8,1.8) node[circ]{} to[C, l_=$C_1$] (1.8,0) node[circ]{};
\draw (0,0) -- (2.8,0) node[ocirc]{};
\draw (2.8,1.5) node[font=\small]{$+$} (2.8,0.3) node[font=\small]{$-$};
\node at (3.4,0.9) {$V_\mathrm{out}$};
% V_out follows V_in - V_D,on to the peak, then holds V_0 - V_D,on
\begin{axis}[sketch, at={(5.2cm,-1.6cm)}, width=7.4cm, height=4.6cm, xmin=0, xmax=1.65, ymin=-1.2, ymax=1.2, xlabel={$t$}, ytick={1,-1}, yticklabels={$V_0$,$-V_0$}, yticklabel style={font=\small}]
  \addplot[black, line width=0.8pt, domain=0:1.6, samples=200] {sin(deg(2*pi*x))};
  \addplot[line width=1.4pt, domain=0:1.6, samples=300] {x<0.024 ? 0 : (x<0.25 ? sin(deg(2*pi*x))-0.15 : 0.85)};
  \draw[<->, gaaccent] (axis cs:0.75,0.84) -- (axis cs:0.75,-0.99);
  \node[font=\small, anchor=west] at (axis cs:0.45,0.2) {$V_\mathrm{in}$};
  \node[font=\small, anchor=south west] at (axis cs:0.3,0.86) {$V_0 - V_\mathrm{D,on}$};
  \draw[note, ->] (axis cs:1.2,1.3) -- (axis cs:0.85,0.9);
\end{axis}
\begin{scope}[shift={(10.2cm,1.75cm)}, scale=0.8, transform shape]
\draw (0,0) to[american voltage source, l=$V_\mathrm{in}$, invert] (0,1.4) -- (0.6,1.4) to[opening switch] (1.6,1.4) -- (2.2,1.4) to[C, l=$V_0 - V_\mathrm{D,on}$] (2.2,0) -- (0,0);
\end{scope}
\end{circuitikz}
\end{document}
