# Drawing signals with foreach

How to draw this signal especially sawtooth using foreach. Square wave is clock signal can be drawn using tikztimingtable package. Is there any other better way to draw these signals in circuitikz? Commands for clock signal

\begin{tikztimingtable}[
timing/slope=0,         % no slope
timing/coldist=2pt,     % column distance
xscale=4,yscale=4, % scale diagrams
semithick               % set line width
]
% \scriptsize
M$_N$   &  10{2C} G \\
\extracode
\makeatletter
\end{tikztimingtable}%


From the tikz-timing manual it doesn't look like the package supports non-square waves.

Below is an example of how to draw such a thing in plain tikz using \foreach as you ask. The same would probably work in circuitikz as well.

\documentclass[tikz, border=3pt]{standalone}
\begin{document}
\begin{tikzpicture}[yscale=.5]
\draw[help lines] (0,0) grid (7,2);
\draw[thick] (0,1) node[anchor=base east] {$\mathsf{M}_N$} -- ++(1,0)
\foreach \x in {1,...,3}{
-- +(0,.5) -- +(1,.5) -- +(1,0) -- ++(2,0)
} -- +(0,.5);
\draw[thick] (0,0) node[anchor=base east] {$S$} -- ++(1,0)
\foreach \x in {1,...,3}{
-- +(1,.5) -- +(1.2,0) -- ++(2,0)
};
\end{tikzpicture}
\end{document}


Hopefully it's not too hard to see how to extend this to other wave shapes and larger tables.