Skip to content

Signals

Generators of standard test signals for modeling, identification, and verification of control systems in TensorAeroSpace.

TensorAeroSpace provides 17 types of signals for comprehensive system testing and analysis:

  • Basic signals: Step, Ramp, Pulse, Constant
  • Periodic signals: Sinusoid, Square wave, Triangular wave, Sawtooth
  • Complex signals: Chirp, Doublet, Multi-step, Exponential, Gaussian pulse, Multisine, Damped sinusoid
  • Random signals: Full random signal

Quick Start

from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import unit_step, sinusoid, chirp, doublet
from tensoraerospace.signals.random import full_random_signal
import numpy as np

# Time axis 0..20 s (default step)
tp = generate_time_period(tn=20)

# Step of 5° at t = 10 s
u_step = unit_step(degree=5, tp=tp, time_step=10, output_rad=False)

# Sine wave with amplitude 10 units, frequency 0.01 Hz
u_sin = sinusoid(tp=tp, amplitude=10, frequency=0.01)

# Chirp signal for frequency response analysis
u_chirp = chirp(tp, f0=0.1, f1=2.0, amplitude=2.0, method='linear')

# Doublet for aerospace maneuvers
u_doublet = doublet(tp, amplitude=np.deg2rad(5), time_start=5.0, width=1.0)

# Random signal with random frequency and amplitude
u_rand = full_random_signal(0, 0.01, 20, (-0.5, 0.5), (-0.5, 0.5))

Units

For functions that support it, the output_rad=False parameter returns angles in degrees. Set it to True to get radians.


Basic Signals

Step Signal

A classic step input for exciting transient processes and analyzing system response.

unit_step(tp, degree, time_step=10.0, dt=0.01, output_rad=False)

Generate unit step signal for control system testing.

Creates a step function that transitions from 0 to a specified amplitude at a given time. Commonly used for analyzing system transient response and step response characteristics.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
degree float

Step amplitude (deflection angle in degrees if output_rad=False, or will be converted to radians if output_rad=True).

required
time_step float

Time at which the step occurs, in seconds. Defaults to 10.0.

10.0
dt float

Discretization time step, in seconds. Defaults to 0.01. (Note: This parameter is not currently used in the function).

0.01
output_rad bool

If True, converts degree to radians. Defaults to False.

False

Returns:

Type Description
ndarray

Step signal array of the same shape as tp, with values of 0 before

ndarray

time_step and the specified amplitude after time_step.

Examples:

>>> t = np.linspace(0, 20, 2001)
>>> step = unit_step(t, degree=5, time_step=5.0, output_rad=False)
>>> # Creates a step of amplitude 5 starting at t=5s
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import unit_step

tp = generate_time_period(tn=20)
u = unit_step(degree=5, tp=tp, time_step=10, output_rad=False)

Generated step signal


Ramp Signal

Linear increasing signal for testing tracking capability of control systems.

ramp(tp, slope=1.0, time_start=0.0)

Generate ramp (linearly increasing) signal.

Creates a ramp signal for testing the tracking capability of control systems to linearly varying reference trajectories.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
slope float

Rate of increase (units per second). Defaults to 1.0.

1.0
time_start float

Time at which the ramp begins, in seconds. Before this time, the signal is zero. Defaults to 0.0.

0.0

Returns:

Type Description
ndarray

Ramp signal array that increases linearly with the specified slope

ndarray

after time_start, and is zero before time_start.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> ramp_sig = ramp(t, slope=0.5, time_start=2.0)
>>> # Creates a ramp starting at t=2s with slope 0.5
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import ramp

tp = generate_time_period(tn=20)
u = ramp(tp, slope=0.5, time_start=2.0)

Ramp signal


Pulse Signal

Rectangular pulse for analyzing impulse response and transient behavior.

pulse(tp, amplitude=1.0, time_start=0.0, width=1.0)

Generate rectangular pulse signal.

Creates a pulse signal for analyzing impulse response and transient behavior of control systems.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
amplitude float

Pulse amplitude (height). Defaults to 1.0.

1.0
time_start float

Time at which pulse begins, in seconds. Defaults to 0.0.

0.0
width float

Duration of the pulse, in seconds. Defaults to 1.0.

1.0

Returns:

Type Description
ndarray

Pulse signal array with value 'amplitude' from time_start to

ndarray

(time_start + width), and zero elsewhere.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> pulse_sig = pulse(t, amplitude=5.0, time_start=3.0, width=2.0)
>>> # Creates a pulse from t=3s to t=5s with amplitude 5.0
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import pulse

tp = generate_time_period(tn=20)
u = pulse(tp, amplitude=5.0, time_start=5.0, width=3.0)

Pulse signal


Constant Signal

Constant reference signal for setpoint tracking and steady-state analysis.

constant_line(tp, value_state=2)

Generate constant reference signal.

Creates a constant-valued signal useful for setpoint tracking tests and steady-state analysis of control systems.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
value_state float

Constant value to maintain throughout the signal. Defaults to 2.

2

Returns:

Type Description
ndarray

Array of constant values with the same shape as tp, where all

ndarray

elements equal value_state.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> const = constant_line(t, value_state=5.0)
>>> # Creates a signal with constant value 5.0
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import constant_line

tp = generate_time_period(tn=20)
u = constant_line(tp, value_state=3.0)

Constant signal


Periodic Signals

Sinusoidal Signal

Used for frequency analysis and testing linear subsystems.

sinusoid(tp, frequency, amplitude)

Generate sinusoidal signal for frequency analysis.

Creates a standard sinusoidal signal used for frequency response analysis and harmonic testing of control systems.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequency float

Signal frequency in Hz (cycles per unit time).

required
amplitude float

Signal peak amplitude.

required

Returns:

Type Description
ndarray

Sinusoidal signal array of the same shape as tp, following

ndarray

amplitude * sin(2pifrequency*tp).

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> sine = sinusoid(t, frequency=1.0, amplitude=1.0)
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import sinusoid

tp = generate_time_period(tn=20)
u = sinusoid(tp=tp, amplitude=10, frequency=0.01)

Sinusoidal signal


Sinusoid with Vertical Shift

Sinusoidal signal with DC offset for testing systems with non-zero operating points.

sinusoid_vertical_shift(tp, frequency, amplitude, vertical_shift=0.0)

Generate sinusoidal signal with DC offset.

Creates a sinusoidal signal with a vertical offset, useful for testing systems with non-zero operating points or bias conditions.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequency float

Oscillation frequency in Hz.

required
amplitude float

Peak amplitude of oscillation.

required
vertical_shift float

DC offset (vertical shift) of the signal. Defaults to 0.0.

0.0

Returns:

Type Description
ndarray

Sinusoidal signal array oscillating between

ndarray

(vertical_shift - amplitude) and (vertical_shift + amplitude).

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> signal = sinusoid_vertical_shift(
...     t, frequency=0.5, amplitude=2.0, vertical_shift=5.0)
>>> # Signal oscillates between 3.0 and 7.0
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import sinusoid_vertical_shift

tp = generate_time_period(tn=20)
u = sinusoid_vertical_shift(tp, frequency=0.5, amplitude=2.0, vertical_shift=5.0)

Sinusoid with vertical shift


Square Wave

Periodic square wave for switching control and relay-based systems.

square_wave(tp, frequency=1.0, amplitude=1.0, duty_cycle=0.5)

Generate square wave signal.

Creates a periodic square wave useful for switching control systems, relay-based control, and testing system response to periodic ON/OFF inputs.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequency float

Oscillation frequency in Hz. Defaults to 1.0.

1.0
amplitude float

Signal amplitude (high level). Low level is always 0. Defaults to 1.0.

1.0
duty_cycle float

Fraction of each period where signal is high (0 to 1). For example, 0.5 means signal is high for 50% of each period. Defaults to 0.5.

0.5

Returns:

Type Description
ndarray

Square wave signal array alternating between 0 and amplitude at the

ndarray

specified frequency and duty cycle.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> sq = square_wave(t, frequency=0.5, amplitude=3.0, duty_cycle=0.3)
>>> # Square wave at 0.5 Hz, high for 30% of each cycle
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import square_wave

tp = generate_time_period(tn=20)
u = square_wave(tp, frequency=0.5, amplitude=3.0, duty_cycle=0.5)

Square wave signal


Triangular Wave

Smooth periodic signal with symmetric rise and fall times.

triangular_wave(tp, frequency=1.0, amplitude=1.0)

Generate triangular wave signal.

Creates a periodic triangular wave with symmetric rise and fall times. Useful for smooth periodic reference signals in control system testing.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequency float

Oscillation frequency in Hz. Defaults to 1.0.

1.0
amplitude float

Peak amplitude. Signal ranges from -amplitude to +amplitude. Defaults to 1.0.

1.0

Returns:

Type Description
ndarray

Triangular wave signal array with values varying linearly between

ndarray

-amplitude and +amplitude with equal rise and fall times.

Examples:

>>> t = np.linspace(0, 5, 1000)
>>> tri = triangular_wave(t, frequency=0.5, amplitude=3.0)
>>> # Triangular wave oscillating between -3.0 and +3.0
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import triangular_wave

tp = generate_time_period(tn=20)
u = triangular_wave(tp, frequency=0.3, amplitude=4.0)

Triangular wave signal


Sawtooth Wave

Periodic sawtooth signal with linear increase from negative to positive amplitude.

sawtooth(tp, frequency=1.0, amplitude=1.0)

Generate sawtooth wave signal.

Creates a periodic sawtooth wave with linear increase from negative to positive amplitude. Useful for sweep generators and linear ramp testing.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequency float

Oscillation frequency in Hz. Defaults to 1.0.

1.0
amplitude float

Peak amplitude. Signal ranges from -amplitude to +amplitude. Defaults to 1.0.

1.0

Returns:

Type Description
ndarray

Sawtooth wave signal array with values linearly increasing from

ndarray

-amplitude to +amplitude within each period.

Examples:

>>> t = np.linspace(0, 5, 1000)
>>> saw = sawtooth(t, frequency=0.5, amplitude=2.0)
>>> # Sawtooth wave oscillating between -2.0 and +2.0
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import sawtooth

tp = generate_time_period(tn=20)
u = sawtooth(tp, frequency=0.4, amplitude=3.0)

Sawtooth signal


Complex Signals

Chirp Signal

Swept-frequency signal for system identification and frequency response analysis.

chirp(tp, f0=0.1, f1=1.0, amplitude=1.0, method='linear')

Generate chirp signal with frequency sweep.

Creates a swept-frequency sinusoid (chirp) for system identification and frequency response analysis. The instantaneous frequency increases from f0 to f1 over the duration of the signal.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
f0 float

Starting frequency in Hz. Defaults to 0.1.

0.1
f1 float

Ending frequency in Hz. Defaults to 1.0.

1.0
amplitude float

Signal amplitude (peak value). Defaults to 1.0.

1.0
method str

Frequency sweep method. Options are: - 'linear': Linear frequency increase (constant rate) - 'exponential': Exponential frequency increase (logarithmic) Defaults to 'linear'.

'linear'

Returns:

Type Description
ndarray

Chirp signal array with frequency varying from f0 to f1.

Raises:

Type Description
ValueError

If method is not 'linear' or 'exponential'.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> chirp_sig = chirp(t, f0=0.1, f1=5.0, amplitude=2.0,
...                   method='linear')
>>> # Linear frequency sweep from 0.1 Hz to 5.0 Hz
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import chirp

tp = generate_time_period(tn=20)
u = chirp(tp, f0=0.1, f1=2.0, amplitude=2.0, method='linear')

Chirp signal


Doublet

Aerospace maneuver signal consisting of positive and negative pulses for stability analysis.

doublet(tp, amplitude=1.0, time_start=0.0, width=1.0)

Generate doublet signal for stability analysis.

Creates a doublet signal consisting of a positive pulse followed immediately by a negative pulse of equal magnitude and duration. Commonly used in aerospace for stability and control analysis, particularly for aircraft handling qualities testing.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
amplitude float

Amplitude of both positive and negative pulses. Defaults to 1.0.

1.0
time_start float

Time at which the doublet begins, in seconds. Defaults to 0.0.

0.0
width float

Duration of each pulse (positive and negative), in seconds. Total doublet duration is 2*width. Defaults to 1.0.

1.0

Returns:

Type Description
ndarray

Doublet signal array with a positive pulse from time_start to

ndarray

(time_start + width), followed by a negative pulse from

ndarray

(time_start + width) to (time_start + 2*width), and zero elsewhere.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> doublet_sig = doublet(t, amplitude=np.deg2rad(5),
...                       time_start=3.0, width=1.0)
>>> # 5-degree doublet maneuver starting at t=3s
import numpy as np
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import doublet

tp = generate_time_period(tn=20)
u = doublet(tp, amplitude=np.deg2rad(10), time_start=5.0, width=1.0)

Doublet signal


Multi-Step Signal

Sequence of step changes for testing tracking performance with multiple setpoints.

multi_step(tp, step_times, step_values)

Generate multi-step signal with multiple setpoint changes.

Creates a signal with multiple step changes at specified times, useful for testing tracking performance and setpoint response of control systems. Each step adds cumulatively to create a staircase pattern.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
step_times list

List of times (in seconds) when each step occurs. Must have the same length as step_values.

required
step_values list

List of step magnitudes. Each value is added to the cumulative signal at the corresponding step_time. Must have the same length as step_times.

required

Returns:

Type Description
ndarray

Multi-step signal array where the signal value at any time is the

ndarray

cumulative sum of all step_values that have occurred up to that time.

Raises:

Type Description
ValueError

If step_times and step_values have different lengths.

Examples:

>>> t = np.linspace(0, 20, 2000)
>>> steps = multi_step(t, step_times=[2, 5, 10, 15],
...                    step_values=[1, 2, -1, 3])
>>> # Signal: 0→1 at t=2, 1→3 at t=5, 3→2 at t=10, 2→5 at t=15
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import multi_step

tp = generate_time_period(tn=20)
u = multi_step(tp, step_times=[2, 5, 8, 12, 16], step_values=[1, 2, -1, 3, -2])

Multi-step signal


Exponential Signal

Smooth exponential approach to final value, modeling first-order system response.

exponential(tp, amplitude=1.0, time_constant=1.0, time_start=0.0)

Generate exponential approach signal.

Creates a signal that exponentially approaches a final value, modeling first-order system response or smooth transitions in control systems. The signal follows the form: amplitude * (1 - e^(-t/τ)).

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
amplitude float

Final asymptotic value that the signal approaches. Defaults to 1.0.

1.0
time_constant float

Time constant τ (tau) in seconds. The signal reaches approximately 63.2% of the final value after one time constant. Defaults to 1.0.

1.0
time_start float

Time at which the exponential rise begins, in seconds. Signal is zero before this time. Defaults to 0.0.

0.0

Returns:

Type Description
ndarray

Exponential signal array that rises from 0 to approach amplitude

ndarray

with the specified time constant, starting at time_start.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> exp_sig = exponential(t, amplitude=10.0, time_constant=2.0,
...                       time_start=1.0)
>>> # Exponential rise from 0 to 10 with τ=2s, starting at t=1s
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import exponential

tp = generate_time_period(tn=20)
u = exponential(tp, amplitude=10.0, time_constant=2.0, time_start=3.0)

Exponential signal


Gaussian Pulse

Bell-shaped pulse for smooth disturbances and band-limited excitations.

gaussian_pulse(tp, amplitude=1.0, center=0.0, width=1.0)

Generate Gaussian-shaped pulse signal.

Creates a smooth, bell-shaped pulse based on the Gaussian (normal) distribution. Useful for modeling smooth disturbances and analyzing system response to band-limited excitations.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
amplitude float

Peak amplitude of the pulse at its center. Defaults to 1.0.

1.0
center float

Time at which the pulse reaches its peak, in seconds. Defaults to 0.0.

0.0
width float

Standard deviation (σ) of the Gaussian distribution, in seconds. Controls the pulse width; larger values create wider pulses. Defaults to 1.0.

1.0

Returns:

Type Description
ndarray

Gaussian pulse signal array with peak at 'center' and shape

ndarray

determined by 'width' (standard deviation).

Examples:

>>> t = np.linspace(0, 20, 2000)
>>> gauss = gaussian_pulse(t, amplitude=5.0, center=10.0, width=1.5)
>>> # Gaussian pulse centered at t=10s with σ=1.5s
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import gaussian_pulse

tp = generate_time_period(tn=20)
u = gaussian_pulse(tp, amplitude=8.0, center=10.0, width=1.5)

Gaussian pulse signal


Multisine Signal

Sum of multiple sinusoids for multi-frequency system excitation and MIMO analysis.

multisine(tp, frequencies, amplitudes, phases=None)

Generate multi-sine signal for multi-frequency excitation.

Creates a signal that is the sum of multiple sinusoids with different frequencies, amplitudes, and phases. Particularly useful for system identification, frequency response testing, and MIMO system analysis where simultaneous excitation at multiple frequencies is desired.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequencies list

List of frequencies in Hz for each sinusoidal component. Must have the same length as amplitudes.

required
amplitudes list

List of amplitudes for each sinusoidal component. Must have the same length as frequencies.

required
phases Optional[list]

List of phase shifts in radians for each component. If None, all phases are set to 0. If provided, must have the same length as frequencies. Defaults to None.

None

Returns:

Type Description
ndarray

Multi-sine signal array that is the sum of all sinusoidal

ndarray

components with specified parameters.

Raises:

Type Description
ValueError

If frequencies and amplitudes have different lengths, or if phases (when provided) has different length than frequencies.

Examples:

>>> t = np.linspace(0, 10, 1000)
>>> ms = multisine(t, frequencies=[0.5, 1.0, 2.0],
...                amplitudes=[2.0, 1.5, 1.0],
...                phases=[0, np.pi/4, np.pi/2])
>>> # Sum of three sinusoids at 0.5, 1.0, and 2.0 Hz
import numpy as np
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import multisine

tp = generate_time_period(tn=20)
u = multisine(tp, frequencies=[0.2, 0.5, 1.0, 1.5], 
              amplitudes=[2.0, 1.5, 1.0, 0.5],
              phases=[0, np.pi/4, np.pi/2, np.pi])

Multisine signal


Damped Sinusoid

Exponentially decaying oscillation, characteristic of underdamped systems.

damped_sinusoid(tp, frequency=1.0, amplitude=1.0, damping=0.1, time_start=0.0)

Generate damped (decaying) sinusoidal signal.

Creates an exponentially decaying sinusoidal signal, characteristic of underdamped second-order systems. Useful for modeling oscillatory responses with energy dissipation, such as mechanical vibrations or RLC circuit responses.

The signal follows: amplitude * exp(-ζt) * sin(2πft) where ζ is the damping coefficient.

Parameters:

Name Type Description Default
tp ndarray

Time array in seconds.

required
frequency float

Oscillation frequency in Hz. Defaults to 1.0.

1.0
amplitude float

Initial amplitude at time_start (before damping). Defaults to 1.0.

1.0
damping float

Damping coefficient (ζ, zeta) that controls the rate of exponential decay. Larger values cause faster decay. Defaults to 0.1.

0.1
time_start float

Time at which oscillations begin, in seconds. Signal is zero before this time. Defaults to 0.0.

0.0

Returns:

Type Description
ndarray

Damped sinusoidal signal array that oscillates at the specified

ndarray

frequency while exponentially decaying in amplitude.

Examples:

>>> t = np.linspace(0, 20, 2000)
>>> damp_sin = damped_sinusoid(t, frequency=1.0, amplitude=5.0,
...                            damping=0.2, time_start=2.0)
>>> # Decaying oscillation at 1 Hz, starting at t=2s
from tensoraerospace.utils import generate_time_period
from tensoraerospace.signals.standard import damped_sinusoid

tp = generate_time_period(tn=20)
u = damped_sinusoid(tp, frequency=1.0, amplitude=5.0, damping=0.3, time_start=2.0)

Damped sinusoid signal


Random Signals

Random Signal by Frequency and Amplitude

Generates a random test input with configurable frequency and amplitude ranges for modeling disturbances.

full_random_signal(t0, dt, tn, sd, sv)

Random signal with variable frequency and amplitude.

Parameters:

Name Type Description Default
t0 float

Initial time.

required
dt float

Discretization step.

required
tn float

Signal duration.

required
sd tuple

Signal duration constraints (min, max).

required
sv tuple

Signal value constraints (min, max).

required

Returns:

Type Description
ndarray

np.ndarray: Array with random signal by frequency and amplitude.

from tensoraerospace.signals.random import full_random_signal

# full_random_signal(t0, dt, tn, amplitude_range, frequency_range)
u = full_random_signal(0, 0.01, 20, (-0.5, 0.5), (-0.5, 0.5))

Random signal by frequency and amplitude


Notes

  • Use tensoraerospace.utils.generate_time_period to build the time axis.
  • All functions return an array of signal values that aligns with the tp time axis.
  • For aerospace applications, doublet signals are particularly useful for flight control testing.
  • Chirp signals are ideal for system identification and frequency response analysis.
  • Combine multiple signals to create complex test scenarios.
  • Chirp f0 parameter: f0 must be positive; a ValueError is raised otherwise.
  • Chirp exponential mode with f0 == f1: When f0 equals f1 in exponential mode, the function returns a constant-frequency sinusoid instead of raising an error.