[Tex/LaTex] Plotting a rectangular waveform with LaTeX

diagramspst-plotpstrickstikz-pgf

I need to plot a rectangular waveform with Latex. The main problem is how to make the height of the pulse "variable" not a "number" as you can see in the figure below. "x" here is some variable that will be found by calculations.

enter image description here

Best Answer

A PSTricks solution just for comparison purpose.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}(-1,-1)(11.5,5.5)
    \psaxes[ticks=x,labels=x]{->}(0,0)(-1,-1)(11,5)[$t$,0][$A(t)$,90]
    \multips(0,0)(2,0){5}{\psline[linecolor=blue,linewidth=2pt](0,0)(0,4)(1,4)(1,0)(2,0)}
    \uput{5pt}[180](0,4){$\sqrt{R_s}$}
\end{pspicture}
\end{document}

enter image description here

Related Question