Singularity Functions#

Continous Domain#

Unit Step Function#

The unit step function \( u(t) \) is defined as:

\[\begin{split} u(t) = \begin{cases} 0 & \text{if } t < 0 \\ 1 & \text{if } t \geq 0 \end{cases} \end{split}\]

This function is used to represent a signal that turns on at \( t = 0 \).

Unit Impulse Function#

The unit impulse function \( \delta(t) \) is defined as the derivative of the unit step function:

\[ \delta(t) = \frac{d}{dt}u(t) \]

It has the sifting property:

\[ \int_{-\infty}^{\infty} \delta(t) \, dt = 1 \]

And for any continuous function \( f(t) \):

\[ \int_{-\infty}^{\infty} f(t) \delta(t - t_0) \, dt = f(t_0) \]

Unit Ramp Function#

The unit ramp function \( r(t) \) is defined as the integral of the unit step function:

\[\begin{split} r(t) = \int_{-\infty}^{t} u(\tau) \, d\tau = \begin{cases} 0 & \text{if } t < 0 \\ t & \text{if } t \geq 0 \end{cases} \end{split}\]

Physical Step Function#

The physical step function is a more realistic version of the unit step function, representing a gradual transition rather than an instantaneous jump. It can be modeled using the sigmoid function:

\[ \text{sigmoid}(t) = \frac{1}{1 + e^{-\alpha t}} \]

where \( \alpha \) determines the steepness of the transition.

Derivative Relations#

  1. Unit impulse function is the derivative of the unit step function:

\[ \delta(t) = \frac{d}{dt} u(t) \]
  1. Unit step function is the derivative of the unit ramp function:

\[ u(t) = \frac{d}{dt} r(t) \]

Properties of the Impulse Function#

  1. Sifting Property: $\( \int_{-\infty}^{\infty} f(t) \delta(t - t_0) \, dt = f(t_0) \)$

  2. Scaling Property: $\( \delta(at) = \frac{1}{|a|} \delta(t) \)$

  3. Shifting Property: $\( \delta(t - t_0) \)$

  4. Derivative of the unit step function

\[ \delta(t - t_0) = \frac{d u(t - t_0)}{dt} \]
  1. Integral of the Impulse Function: $\( \int_{-\infty}^{t} \delta(\tau) \, d\tau = u(t) \)$

The impulse function is defined by its properties rather than by its values

Summary Table#

Function

Definition

Relation

Unit Step Function

\( u(t) = \begin{cases} 0 & t < 0 \\ 1 & t \geq 0 \end{cases} \)

\( u(t) = \frac{d}{dt} r(t) \)

Unit Impulse Function

\( \delta(t) = \frac{d}{dt} u(t) \)

-

Unit Ramp Function

\( r(t) = \begin{cases} 0 & t < 0 \\ t & t \geq 0 \end{cases} \)

\( r(t) = \int_{-\infty}^{t} u(\tau) \, d\tau \)

Physical Step Function

\( \text{sigmoid}(t) = \frac{1}{1 + e^{-\alpha t}} \)

-

Python code#

This Python code generates plots for the unit step function, unit impulse function (approximated), unit ramp function, and physical step function (sigmoid). Each plot illustrates the respective function over time.

import numpy as np
import matplotlib.pyplot as plt

# Time array
t = np.linspace(-2, 2, 400)

# Unit step function
u = np.heaviside(t, 1)

# Unit impulse function approximation
delta = np.zeros_like(t)
delta[np.abs(t) < 0.01] = 1 / 0.02

# Unit ramp function
r = np.maximum(0, t)

# Physical step function (sigmoid)
alpha = 5
sigmoid = 1 / (1 + np.exp(-alpha * t))

# Plotting
fig, axs = plt.subplots(2, 2, figsize=(20, 8))

# Font size
fontsize = 18

# Plot unit step function
axs[0, 0].plot(t, u, label='$u(t)$')
axs[0, 0].set_title('Unit Step Function', fontsize=fontsize)
axs[0, 0].set_xlabel('Time $t$', fontsize=fontsize)
axs[0, 0].set_ylabel('$u(t)$', fontsize=fontsize)
axs[0, 0].legend(fontsize=fontsize)
axs[0, 0].tick_params(axis='both', which='major', labelsize=fontsize)
axs[0, 0].grid(True)

# Plot unit impulse function
axs[0, 1].stem(t, delta, label='$\\delta(t)$', basefmt=" ")
axs[0, 1].set_title('Unit Impulse Function', fontsize=fontsize)
axs[0, 1].set_xlabel('Time $t$', fontsize=fontsize)
axs[0, 1].set_ylabel('$\\delta(t)$', fontsize=fontsize)
axs[0, 1].legend(fontsize=fontsize)
axs[0, 1].tick_params(axis='both', which='major', labelsize=fontsize)
axs[0, 1].grid(True)

# Plot unit ramp function
axs[1, 0].plot(t, r, label='$r(t)$')
axs[1, 0].set_title('Unit Ramp Function', fontsize=fontsize)
axs[1, 0].set_xlabel('Time $t$', fontsize=fontsize)
axs[1, 0].set_ylabel('$r(t)$', fontsize=fontsize)
axs[1, 0].legend(fontsize=fontsize)
axs[1, 0].tick_params(axis='both', which='major', labelsize=fontsize)
axs[1, 0].grid(True)

# Plot physical step function (sigmoid)
axs[1, 1].plot(t, sigmoid, label='$\text{sigmoid}(t)$')
axs[1, 1].set_title('Physical Step Function', fontsize=fontsize)
axs[1, 1].set_xlabel('Time $t$', fontsize=fontsize)
axs[1, 1].set_ylabel('$\text{sigmoid}(t)$', fontsize=fontsize)
axs[1, 1].legend(fontsize=fontsize)
axs[1, 1].tick_params(axis='both', which='major', labelsize=fontsize)
axs[1, 1].grid(True)

plt.tight_layout()
plt.show()
_images/60b15ec3d1ef80b1f9cf13f6ac3d62837262291c3020193b5f43a1a0d34adbca.png

Discrete Domain#

Singularity functions in the discrete domain are analogous to those in the continuous domain but are defined for discrete-time signals. Here, we will explore the unit step function, unit impulse function, unit ramp function, and physical step function in the discrete domain. We will also illustrate these functions using Python.

Unit Step Function#

The unit step function \( u[n] \) is defined as:

\[\begin{split} u[n] = \begin{cases} 0 & \text{if } n < 0 \\ 1 & \text{if } n \geq 0 \end{cases} \end{split}\]

This function is used to represent a signal that turns on at \( n = 0 \).

Unit Impulse Function#

The unit impulse function \( \delta[n] \) is defined as the difference between \( u[n] \) and \( u[n-1] \):

\[\begin{split} \delta[n] = \begin{cases} 1 & \text{if } n = 0 \\ 0 & \text{otherwise} \end{cases} \end{split}\]

It has the sifting property:

\[ \sum_{n=-\infty}^{\infty} \delta[n] = 1 \]

And for any discrete function \( f[n] \):

\[ \sum_{n=-\infty}^{\infty} f[n] \delta[n - n_0] = f[n_0] \]

Unit Ramp Function#

The unit ramp function \( r[n] \) is defined as the sum of the unit step function:

\[\begin{split} r[n] = \begin{cases} 0 & \text{if } n < 0 \\ n & \text{if } n \geq 0 \end{cases} \end{split}\]

Physical Step Function#

The physical step function in the discrete domain is a more realistic version of the unit step function, representing a gradual transition rather than an instantaneous jump. It can be modeled using the sigmoid function:

\[ \text{sigmoid}(n) = \frac{1}{1 + e^{-\alpha n}} \]

where \( \alpha \) determines the steepness of the transition.

import numpy as np
import matplotlib.pyplot as plt

# Discrete time variable
n = np.arange(-20, 20)

# Unit step function
u = np.heaviside(n, 1)

# Unit impulse function
delta = np.zeros_like(n)
delta[n == 0] = 1

# Unit ramp function
r = np.maximum(0, n)

# Physical step function (sigmoid)
alpha = 0.5
sigmoid = 1 / (1 + np.exp(-alpha * n))

# Plotting
fig, axs = plt.subplots(2, 2, figsize=(20, 8))

# Font size
fontsize = 18

# Plot unit step function
axs[0, 0].stem(n, u, basefmt=" ")
axs[0, 0].set_title('Unit Step Function', fontsize=fontsize)
axs[0, 0].set_xlabel('n', fontsize=fontsize)
axs[0, 0].set_ylabel('$u[n]$', fontsize=fontsize)
axs[0, 0].tick_params(axis='both', which='major', labelsize=fontsize)
axs[0, 0].grid(True)

# Plot unit impulse function
axs[0, 1].stem(n, delta, basefmt=" ")
axs[0, 1].set_title('Unit Impulse Function', fontsize=fontsize)
axs[0, 1].set_xlabel('n', fontsize=fontsize)
axs[0, 1].set_ylabel('$\\delta[n]$', fontsize=fontsize)
axs[0, 1].tick_params(axis='both', which='major', labelsize=fontsize)
axs[0, 1].grid(True)

# Plot unit ramp function
axs[1, 0].stem(n, r, basefmt=" ")
axs[1, 0].set_title('Unit Ramp Function', fontsize=fontsize)
axs[1, 0].set_xlabel('n', fontsize=fontsize)
axs[1, 0].set_ylabel('$r[n]$', fontsize=fontsize)
axs[1, 0].tick_params(axis='both', which='major', labelsize=fontsize)
axs[1, 0].grid(True)

# Plot physical step function (sigmoid)
axs[1, 1].stem(n, sigmoid, basefmt=" ")
axs[1, 1].set_title('Physical Step Function', fontsize=fontsize)
axs[1, 1].set_xlabel('n', fontsize=fontsize)
axs[1, 1].set_ylabel('$\text{sigmoid}(n)$', fontsize=fontsize)
axs[1, 1].tick_params(axis='both', which='major', labelsize=fontsize)
axs[1, 1].grid(True)

plt.tight_layout()
plt.show()
_images/876a98c4847ae5096ca5a3399b07ed5d1cc16c310b2e098e7635252d67ac2995.png

Summary Table#

Function

Definition

Relation

Unit Step Function

\( u[n] = \begin{cases} 0 & n < 0 \\ 1 & n \geq 0 \end{cases} \)

\( u[n] = \sum_{k=-\infty}^{n} \delta[k] \)

Unit Impulse Function

\( \delta[n] = \begin{cases} 1 & n = 0 \\ 0 & \text{otherwise} \end{cases} \)

-

Unit Ramp Function

\( r[n] = \begin{cases} 0 & n < 0 \\ n & n \geq 0 \end{cases} \)

\( r[n] = \sum_{k=0}^{n} u[k] \)

Physical Step Function

\( \text{sigmoid}(n) = \frac{1}{1 + e^{-\alpha n}} \)

-