The Heaviside step function, also called the unit step function, is named after Oliver Heaviside. Its value is zero for negative arguments and one for positive arguments. It can be used to represent a signal that is first switched off and then switched on at a particular time.
I saw that @MathType showed it on X (Twitter), so I plotted it in LaTeX myself, showing the use of markings and of multiline math content in a plot legend.
We can print the Heaviside step function in LaTeX with pgfplots like this: pic.twitter.com/8oGBlq3bkL
— LaTeX.org (@TeXgallery) January 27, 2025
\documentclass[border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{amsmath} \begin{document} \begin{tikzpicture} \begin{axis}[axis lines = center, xlabel = $x$, ymin = -0.1, ymax = 1.7, xmin = -1.2, xmax = 1.2, legend style = {empty legend, draw = none}] \addplot[very thick, mark = *, mark options = {fill = white}, samples at = {-2,0}] {0}; \addplot[very thick, mark = *, samples at = { 0,2}] {1}; \addlegendentry{$H = \left\{\begin{aligned} 0, \quad & x < 0\\ 1, \quad & x\geq 0 \end{aligned}\right.$} \end{axis} \end{tikzpicture} \end{document}
See also: Original Source by Stefan Kottwitz
Note: The copyright belongs to the blog author and the blog. For the license, please see the linked original source blog.
Leave a Reply
You must be logged in to post a comment.