\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[empty diode] (1.5,1.6) -- (3.6,1.6) node[ocirc]{};
\draw (1.5,1.6) node[circ]{} to[C, l_=$C_1$] (1.5,0) node[circ]{};
\draw (2.7,1.6) node[circ]{} to[R, l=$R_1$] (2.7,0) node[circ]{};
\draw (0,0) -- (3.6,0) node[ocirc]{};
\draw (3.6,1.3) node[font=\small]{$+$} (3.6,0.3) node[font=\small]{$-$};
\node at (4.2,0.8) {$V_\mathrm{out}$};
% V_in = sin, V_D,on = 0.15, tau = 2 (as in lecture 10): decay from the peak at 0.25 until 1.123
\begin{axis}[sketch, at={(5.2cm,-1.1cm)}, width=6.4cm, height=4.4cm, xmin=0, xmax=1.6, ymin=-1.2, ymax=1.3, xlabel={$t$}]
  \addplot[black, line width=0.8pt, domain=0:1.5, samples=250] {sin(deg(2*pi*x))};
  \addplot[line width=1.4pt, domain=0:1.5, samples=500] {x<0.024 ? 0 : (x<0.25 ? sin(deg(2*pi*x))-0.15 : (x<1.1232 ? 0.85*exp(-(x-0.25)/2) : (x<1.25 ? sin(deg(2*pi*x))-0.15 : 0.85*exp(-(x-1.25)/2))))};
  \draw[dim, dashed] (axis cs:0.25,0.85) -- (axis cs:0.95,0.85);
  \draw[dim, dashed] (axis cs:0.85,0.549) -- (axis cs:1.12,0.549);
  \draw[<->, gaaccent] (axis cs:0.9,0.84) -- (axis cs:0.9,0.56) node[pos=0, above, font=\small]{Ripple};
  \node[font=\small, anchor=west] at (axis cs:0.47,0.3) {$V_\mathrm{in}$};
\end{axis}
\end{circuitikz}
\end{document}
