I want to draw a rectified signal with (blue) and without a capacitor (black). This is what I'm getting
This is what I want

Code:
\begin{figure}[H]
\begin{tikzpicture}
\draw (0,0) -- (12,0);
\draw (0.2,1.5)node[left,font=\tiny] {$y=12$} -- (11.8,1.5);
\draw (0.2,-1.5)node[left,font=\tiny] {$y=-12$} -- (11.8,-1.5);
\foreach \x in {0,0.5,...,12}{
\draw (\x,-0.2)node [below,font=\tiny,] {\x} -- (\x,0.2) ;
}
\draw[ thick, black] (0,0) sin (1,1); %% the real business in this line
\draw[ thick, black] (1,1) cos (2,0); %% the real business in this line
\draw[ thick, line join=round , blue] (1,1) to (4.1,0.35);
\draw[ thick, black] (2,0) to (3,0); %% the real business in this line
\draw[ thick, black] (3,0) to (4,0); %% the real business in this line
\draw[ thick, black] (4,0) sin (5,1); %% the real business in this line
\draw[ thick, black] (5,1) cos (6,0); %% the real business in this line
\draw[ thick, black] (6,0) to (7,0); %% the real business in this line
\draw[ thick, black] (7,0) to (8,0); %% the real business in this line
\draw[ thick, black] (8,0) sin (9,1); %% the real business in this line
\draw[ thick, black] (9,1) cos (10,0); %% the real business in this line
\draw[ thick, black] (10,0) to (11,0); %% the real business in this line
\end{tikzpicture}
\caption{nach gleischrichtung}
\label{halb_welle_schaltung}
\end{figure}
pgfplotswould help? You could plot the curve as a combination of sine waves and exponential decay. – Håkon Marthinsen Dec 20 '15 at 14:05