In digital signal processing, we utilize various elementary sequences for the purpose of analysis. In this series, we will see such sequences. One such elementary sequence is the unit step sequence (see the articles on unit sample sequence, unit step sequence, real-valued exponential sequence, complex exponential sequence).
Unit Step Sequence
A unit step sequence is a discrete-time signal that represents a step function. In discrete-time signal processing, a sequence is a set of values indexed by integers. A unit step sequence, denoted as u[n], is defined as follows:
In this definition, the value of \(u[n]\) is 0 for negative values of \(n\) (\(n \lt 0\)), and it is 1 for non-negative values of \(n (n \geq 0)\). The up-arrow indicates the sample at \(n=0\)
Graphically, the sequence looks like a step function, where the value remains zero for negative indices and abruptly jumps to 1 at n=0, continuing at that value for positive indices.
In the equation above, the sequence value of 1 start at index 0. In signal processing, the starting place (where the value 1 starts) can be shifted. The generalized formula for generated a shifted sequence will be
The following python code implements a unit step sequence over the interval \(n_1 \leq n \leq n_2\)
import matplotlib.pyplot as plt
import numpy as np
def unit_step_sequence(n0, n1, n2):
"""
Generate unit step sequence u(n - n0); n1<=n<=n
n0 = number of samples to offset/shift
n1 = starting number to generate the sequence index
n2 = ending number to generate the sequence index
"""
n = np.arange(n1,n2+1)
u = np.zeros_like(n)
u[n >= n0] = 1
return u
# Generate the shifted unit step sequence for a given range and shift value
n0 = 2 # Shift value
n1 = -3
n2 = 9
u = unit_step_sequence(n0, n1, n2)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# Plotting the shifted unit step sequence
plt.stem(np.arange(n1,n2+1), u,'r', markerfmt='o', basefmt='k', use_line_collection=True)
plt.xlabel('n')
plt.ylabel(r'$u[n-n_0]$')
plt.title(r'Discrete-time Unit Step Sequence $u[n-2]$')
plt.grid(True)
plt.show()
Applications
The unit step sequence is often used as a fundamental building block in signal processing and system analysis. It serves as a basic reference for studying and analyzing other signals and systems. By manipulating the sequence, one can derive other useful sequences and functions, such as shifted step sequences, ramp sequences, and more complex signals.
This sequence is particularly important in the field of discrete-time systems, where it is used to analyze system behavior and characterize properties like stability, causality, and linearity. It is also employed in various applications, such as digital filters, signal modeling, and signal reconstruction.