Chapter 4

Signals & Systems

Fourier series, Laplace transforms, and system stability.

Signals & Systems

Signals and systems form the theoretical foundation for understanding how information is processed, transmitted, and analyzed in engineering applications. This mathematical framework is essential for analyzing everything from audio and telecommunications to control systems and biomedical devices.

Signals

Continuous-Time and Discrete-Time Signals

Continuous-Time Signals

x(t),tRx(t), \quad t \in \mathbb{R}

Discrete-Time Signals

x[n],nZx[n], \quad n \in \mathbb{Z}

Signal Classification

Energy and Power Signals

Energy:E=x(t)2dtorE=n=x[n]2\text{Energy}: E = \int_{-\infty}^{\infty} |x(t)|^2 dt \quad \text{or} \quad E = \sum_{n=-\infty}^{\infty} |x[n]|^2 Power:P=limT12TTTx(t)2dt\text{Power}: P = \lim_{T \rightarrow \infty} \frac{1}{2T} \int_{-T}^{T} |x(t)|^2 dt

Periodic and Aperiodic Signals

  • Continuous: x(t)=x(t+T)x(t) = x(t + T) for all tt
  • Discrete: x[n]=x[n+N]x[n] = x[n + N] for all nn

Basic Signals

Unit Step Function

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

Dirac Delta Function

δ(t)={,t=00,t0withδ(t)dt=1\delta(t) = \begin{cases} \infty, & t = 0 \\ 0, & t \neq 0 \end{cases} \quad \text{with} \int_{-\infty}^{\infty} \delta(t) dt = 1 Sifting property:x(t)δ(tt0)dt=x(t0)\text{Sifting property}: \int_{-\infty}^{\infty} x(t)\delta(t - t_0) dt = x(t_0)

Complex Exponential Signals

x(t)=est=e(σ+jω)t=eσtejωtx(t) = e^{st} = e^{(\sigma + j\omega)t} = e^{\sigma t}e^{j\omega t}

Where s=σ+jωs = \sigma + j\omega is a complex frequency.

Systems

System Properties

Linearity

T[ax1(t)+bx2(t)]=aT[x1(t)]+bT[x2(t)]\mathcal{T}[ax_1(t) + bx_2(t)] = a\mathcal{T}[x_1(t)] + b\mathcal{T}[x_2(t)]

Time-Invariance

T[x(tt0)]=y(tt0)\mathcal{T}[x(t - t_0)] = y(t - t_0)

Causality

Output at time t1 depends only on inputs at times tt1\text{Output at time } t_1 \text{ depends only on inputs at times } t \leq t_1

Stability (BIBO)

x(t)Mx<y(t)My<|x(t)| \leq M_x < \infty \Rightarrow |y(t)| \leq M_y < \infty

Convolution

Continuous-Time

y(t)=x(t)h(t)=x(τ)h(tτ)dτy(t) = x(t) * h(t) = \int_{-\infty}^{\infty} x(\tau)h(t - \tau) d\tau

Discrete-Time

y[n]=x[n]h[n]=k=x[k]h[nk]y[n] = x[n] * h[n] = \sum_{k=-\infty}^{\infty} x[k]h[n - k]

Properties

  • Commutativity: xh=hxx * h = h * x
  • Associativity: (xh1)h2=x(h1h2)(x * h_1) * h_2 = x * (h_1 * h_2)
  • Distributivity: x(h1+h2)=xh1+xh2x * (h_1 + h_2) = x * h_1 + x * h_2

Fourier Analysis

Fourier Series

Continuous-Time (CTFS)

For periodic signals with period TT:

x(t)=k=akejkω0t,ω0=2πTx(t) = \sum_{k=-\infty}^{\infty} a_k e^{jk\omega_0 t}, \quad \omega_0 = \frac{2\pi}{T} ak=1T0Tx(t)ejkω0tdta_k = \frac{1}{T} \int_{0}^{T} x(t)e^{-jk\omega_0 t} dt

Discrete-Time (DTFS)

For periodic discrete-time signals with period NN:

x[n]=k=0N1akejk(2π/N)nx[n] = \sum_{k=0}^{N-1} a_k e^{jk(2\pi/N)n} ak=1Nn=0N1x[n]ejk(2π/N)na_k = \frac{1}{N} \sum_{n=0}^{N-1} x[n]e^{-jk(2\pi/N)n}

Fourier Transform

Continuous-Time Fourier Transform (CTFT)

X(ω)=x(t)ejωtdtX(\omega) = \int_{-\infty}^{\infty} x(t)e^{-j\omega t} dt x(t)=12πX(ω)ejωtdωx(t) = \frac{1}{2\pi} \int_{-\infty}^{\infty} X(\omega)e^{j\omega t} d\omega

Discrete-Time Fourier Transform (DTFT)

X(ejω)=n=x[n]ejωnX(e^{j\omega}) = \sum_{n=-\infty}^{\infty} x[n]e^{-j\omega n} x[n]=12πππX(ejω)ejωndωx[n] = \frac{1}{2\pi} \int_{-\pi}^{\pi} X(e^{j\omega})e^{j\omega n} d\omega

Properties of Fourier Transform

  • Linearity: ax1(t)+bx2(t)aX1(ω)+bX2(ω)ax_1(t) + bx_2(t) \leftrightarrow aX_1(\omega) + bX_2(\omega)
  • Time Shifting: x(tt0)X(ω)ejωt0x(t - t_0) \leftrightarrow X(\omega)e^{-j\omega t_0}
  • Frequency Shifting: x(t)ejω0tX(ωω0)x(t)e^{j\omega_0 t} \leftrightarrow X(\omega - \omega_0)
  • Time Scaling: x(at)1aX(ωa)x(at) \leftrightarrow \frac{1}{|a|} X(\frac{\omega}{a})
  • Differentiation: dx(t)dtjωX(ω)\frac{dx(t)}{dt} \leftrightarrow j\omega X(\omega)
  • Convolution: x(t)h(t)X(ω)H(ω)x(t) * h(t) \leftrightarrow X(\omega)H(\omega)

Laplace Transform

Definition

X(s)=0x(t)estdtX(s) = \int_{0}^{\infty} x(t)e^{-st} dt

For bilateral transform, integration is from -\infty to \infty.

Common Transform Pairs

  • u(t)1su(t) \leftrightarrow \frac{1}{s}
  • eatu(t)1s+ae^{-at}u(t) \leftrightarrow \frac{1}{s+a}
  • tnu(t)n!sn+1t^n u(t) \leftrightarrow \frac{n!}{s^{n+1}}
  • sin(ω0t)u(t)ω0s2+ω02\sin(\omega_0 t)u(t) \leftrightarrow \frac{\omega_0}{s^2 + \omega_0^2}
  • cos(ω0t)u(t)ss2+ω02\cos(\omega_0 t)u(t) \leftrightarrow \frac{s}{s^2 + \omega_0^2}

Properties

  • Linearity: ax1(t)+bx2(t)aX1(s)+bX2(s)ax_1(t) + bx_2(t) \leftrightarrow aX_1(s) + bX_2(s)
  • Time Shifting: x(tt0)u(tt0)X(s)est0x(t - t_0)u(t - t_0) \leftrightarrow X(s)e^{-st_0}
  • Frequency Shifting: eatx(t)X(sa)e^{at}x(t) \leftrightarrow X(s-a)
  • Time Differentiation: dx(t)dtsX(s)x(0)\frac{dx(t)}{dt} \leftrightarrow sX(s) - x(0^-)
  • Time Integration: 0tx(τ)dτX(s)s\int_{0}^{t} x(\tau)d\tau \leftrightarrow \frac{X(s)}{s}

Region of Convergence (ROC)

ROC={s:Re{s}>σ0} for causal signals\text{ROC} = \{s : \text{Re}\{s\} > \sigma_0\} \text{ for causal signals} ROC={s:Re{s}<σ0} for anti-causal signals\text{ROC} = \{s : \text{Re}\{s\} < \sigma_0\} \text{ for anti-causal signals}

z-Transform

Definition

X(z)=n=x[n]znX(z) = \sum_{n=-\infty}^{\infty} x[n]z^{-n}

Common Transform Pairs

  • δ[n]1\delta[n] \leftrightarrow 1
  • u[n]zz1u[n] \leftrightarrow \frac{z}{z-1}
  • anu[n]zzaa^n u[n] \leftrightarrow \frac{z}{z-a}
  • nanu[n]az(za)2na^n u[n] \leftrightarrow \frac{az}{(z-a)^2}

ROC Properties

For causal sequences: z>a|z| > |a| (outside circle of radius a|a|) For anti-causal sequences: z<a|z| < |a| (inside circle of radius a|a|)

System Analysis

LTI Systems

Impulse Response

y(t)=x(t)h(t),y[n]=x[n]h[n]y(t) = x(t) * h(t), \quad y[n] = x[n] * h[n]

Frequency Response

H(ω)=F{h(t)},H(ejω)=F{h[n]}H(\omega) = \mathcal{F}\{h(t)\}, \quad H(e^{j\omega}) = \mathcal{F}\{h[n]\}

System Functions

  • Continuous: H(s)=L{h(t)}H(s) = \mathcal{L}\{h(t)\}
  • Discrete: H(z)=Z{h[n]}H(z) = \mathcal{Z}\{h[n]\}

Transfer Function

Rational Function Form

H(s)=Y(s)X(s)=N(s)D(s)=bmsm+bm1sm1++b0sn+an1sn1++a0H(s) = \frac{Y(s)}{X(s)} = \frac{N(s)}{D(s)} = \frac{b_m s^m + b_{m-1} s^{m-1} + \ldots + b_0}{s^n + a_{n-1} s^{n-1} + \ldots + a_0}

Pole-Zero Representation

H(s)=Ki=1m(szi)i=1n(spi)H(s) = K \frac{\prod_{i=1}^{m}(s - z_i)}{\prod_{i=1}^{n}(s - p_i)}

Where ziz_i are zeros and pip_i are poles.

Stability Analysis

Continuous-Time Systems

For BIBO stability: All poles must lie in the left-half of s-plane (Re{pi}<0\text{Re}\{p_i\} < 0).

Discrete-Time Systems

For BIBO stability: All poles must lie inside the unit circle (pi<1|p_i| < 1).

Routh-Hurwitz Criterion

For polynomial D(s)=sn+an1sn1++a1s+a0D(s) = s^n + a_{n-1}s^{n-1} + \ldots + a_1s + a_0:

Form Routh array and check for sign changes in first column.

System Response

Transient and Steady-State

y(t)=ytransient(t)+ysteadystate(t)y(t) = y_{transient}(t) + y_{steady-state}(t)

First-Order Systems

τdy(t)dt+y(t)=Kx(t)H(s)=Kτs+1\tau \frac{dy(t)}{dt} + y(t) = Kx(t) \Rightarrow H(s) = \frac{K}{\tau s + 1}

Step response: y(t)=K(1et/τ)u(t)y(t) = K(1 - e^{-t/\tau})u(t)

Second-Order Systems

d2ydt2+2ξωndydt+ωn2y=Kωn2xH(s)=Kωn2s2+2ξωns+ωn2\frac{d^2y}{dt^2} + 2\xi\omega_n \frac{dy}{dt} + \omega_n^2 y = K\omega_n^2 x \Rightarrow H(s) = \frac{K\omega_n^2}{s^2 + 2\xi\omega_n s + \omega_n^2}

Where ξ\xi is damping ratio and ωn\omega_n is natural frequency.

Filter Design

Ideal Filters

Lowpass Filter

H(Ω)={1,ΩΩc0,Ω>ΩcH(\Omega) = \begin{cases} 1, & |\Omega| \leq \Omega_c \\ 0, & |\Omega| > \Omega_c \end{cases}

Highpass Filter

H(Ω)={0,ΩΩc1,Ω>ΩcH(\Omega) = \begin{cases} 0, & |\Omega| \leq \Omega_c \\ 1, & |\Omega| > \Omega_c \end{cases}

Practical Filters

Butterworth Filter

H(jΩ)2=11+(ΩΩc)2N|H(j\Omega)|^2 = \frac{1}{1 + \left(\frac{\Omega}{\Omega_c}\right)^{2N}}

Maximally flat in passband, monotonic response.

Chebyshev Filter

H(jΩ)2=11+ϵ2TN2(ΩΩc)|H(j\Omega)|^2 = \frac{1}{1 + \epsilon^2 T_N^2\left(\frac{\Omega}{\Omega_c}\right)}

Where TNT_N is Chebyshev polynomial, equiripple in passband.

Elliptic Filter

H(jΩ)2=11+ϵ2RN2(ΩΩc)|H(j\Omega)|^2 = \frac{1}{1 + \epsilon^2 R_N^2\left(\frac{\Omega}{\Omega_c}\right)}

Equiripple in both passband and stopband, steepest roll-off.

Sampling Theory

Nyquist-Shannon Sampling Theorem

fs>2fmax to avoid aliasingf_s > 2f_{max} \text{ to avoid aliasing}

Where fsf_s is sampling frequency and fmaxf_{max} is highest frequency component.

Reconstruction

x(t)=n=x[nT]sinc(tnTT)x(t) = \sum_{n=-\infty}^{\infty} x[nT] \cdot \text{sinc}\left(\frac{t - nT}{T}\right)

Where T=1/fsT = 1/f_s and sinc(x)=sin(πx)πx\text{sinc}(x) = \frac{\sin(\pi x)}{\pi x}.

Modulation and Communication

Amplitude Modulation

y(t)=[A+m(t)]cos(ωct)y(t) = [A + m(t)]\cos(\omega_c t)

Where m(t)m(t) is message signal and ωc\omega_c is carrier frequency.

Frequency Modulation

y(t)=Acos(ωct+kftm(τ)dτ)y(t) = A\cos\left(\omega_c t + k_f \int_{-\infty}^{t} m(\tau) d\tau\right)

Where kfk_f is frequency deviation constant.

Applications in Signal Processing

Digital Filters

FIR Filter Design

y[n]=k=0M1h[k]x[nk]y[n] = \sum_{k=0}^{M-1} h[k]x[n-k]

Linear phase possible, always stable.

IIR Filter Design

k=0Naky[nk]=k=0Mbkx[nk]\sum_{k=0}^{N} a_k y[n-k] = \sum_{k=0}^{M} b_k x[n-k]

More efficient but potentially unstable.

Spectral Analysis

PSD:Sxx(ω)=limT1TE[XT(ω)2]\text{PSD}: S_{xx}(\omega) = \lim_{T \rightarrow \infty} \frac{1}{T} E[|X_T(\omega)|^2]

Where XT(ω)X_T(\omega) is the Fourier transform of the truncated signal x(t)x(t).


Real-World Application: Audio Filter Design

Digital filtering is essential in audio applications for noise reduction, equalization, and signal enhancement.

Audio Filter Analysis

# Design an audio equalizer filter bank
audio_params = {
    'sample_rate': 44100,       # Hz (CD quality)
    'frequency_bands': [60, 250, 1000, 4000, 10000],  # Hz (bass, low-mid, mid, high-mid, treble)
    'bandwidth': 1.41,         # Octave bandwidth (Q-factor related)
    'gain_range': [-12, 12],    # dB (gain adjustment range)
    'filter_type': 'IIR',       # IIR or FIR
    'filter_order': 4,         # Filter order
    'buffer_size': 1024        # Samples for real-time processing
}

# Calculate filter parameters for peaking EQ
center_frequencies = audio_params['frequency_bands']
Q_factors = [f / (audio_params['bandwidth'] * f) for f in center_frequencies]  # Simplified Q calculation

# For each frequency band, design a second-order peaking filter
# Using biquad filter coefficients
# H(s) = (s^2 + s*(A/Q) + 1) / (s^2 + s/(A*Q) + 1) for peaking EQ

filter_coefficients = []
for i, fc in enumerate(center_frequencies):
    # Normalize frequency to [0, 1] (Nyquist frequency = 0.5)
    w0 = 2 * math.pi * fc / audio_params['sample_rate']
    
    # Calculate Q parameter
    Q = Q_factors[i]
    
    # For now, assuming unity gain (flat response)
    A = 1.0  # Linear gain factor
    
    # Calculate biquad coefficients (for peaking filter)
    alpha = math.sin(w0) / (2 * Q)
    
    # Biquad coefficients: b0, b1, b2, a0, a1, a2
    b0 = 1 + alpha*A
    b1 = -2 * math.cos(w0)
    b2 = 1 - alpha*A
    a0 = 1 + alpha/A
    a1 = -2 * math.cos(w0)
    a2 = 1 - alpha/A
    
    coeffs = {
        'b0': b0,
        'b1': b1,
        'b2': b2,
        'a0': a0,
        'a1': a1,
        'a2': a2,
        'center_freq': fc,
        'Q': Q
    }
    filter_coefficients.append(coeffs)

# Calculate total system frequency response
# Using the transfer function for IIR filters
# H(z) = (b0 + b1*z^-1 + b2*z^-2) / (a0 + a1*z^-1 + a2*z^-2)

# Frequency response calculation for each band
frequencies = [20, 100, 250, 500, 1000, 2000, 4000, 8000, 16000]  # Standard frequencies
responses = []

for freq in frequencies:
    z = math.exp(-1j * 2 * math.pi * freq / audio_params['sample_rate'])  # z = e^(-j*2*pi*f/fs)
    
    # Calculate overall response by multiplying all filter responses
    total_response = 1.0
    for coeffs in filter_coefficients:
        numerator = coeffs['b0'] + coeffs['b1']*(1/z) + coeffs['b2']*(1/z)**2
        denominator = coeffs['a0'] + coeffs['a1']*(1/z) + coeffs['a2']*(1/z)**2
        band_response = numerator / denominator
        total_response *= band_response
    
    # Convert to dB
    magnitude_db = 20 * math.log10(abs(total_response))
    responses.append(magnitude_db)

print(f"Audio equalizer analysis at {audio_params['sample_rate']} Hz sample rate:")
print(f"  Center frequencies: {center_frequencies} Hz")
print(f"  Q factors: {[f'{q:.2f}' for q in Q_factors]}")
print(f"  Buffer size: {audio_params['buffer_size']} samples")
print(f"  Filter order: {audio_params['filter_order']}")
print(f"  Gain range: {audio_params['gain_range'][0]} to {audio_params['gain_range'][1]} dB")

# Evaluate frequency response
print(f"\nFrequency Response at selected frequencies:")
for i, freq in enumerate(frequencies):
    print(f"  {freq} Hz: {responses[i]:.2f} dB")

# Calculate filter delay (group delay)
# For IIR biquads, delay varies with frequency
group_delays = []
for freq in frequencies:
    w = 2 * math.pi * freq / audio_params['sample_rate']
    
    # Group delay = -d(phase)/dw
    # For phase calculation of a single biquad
    z = math.exp(-1j * w)
    total_phase = 0
    for coeffs in filter_coefficients:
        numerator = complex(coeffs['b0'] + coeffs['b1']*(1/z) + coeffs['b2']*(1/z)**2)
        denominator = complex(coeffs['a0'] + coeffs['a1']*(1/z) + coeffs['a2']*(1/z)**2)
        transfer_func = numerator / denominator
        total_phase += math.atan2(transfer_func.imag, transfer_func.real)  # Phase in radians
    
    # Approximate group delay
    group_delay = -total_phase / w if w != 0 else 0  # Samples
    group_delays.append(group_delay)

print(f"\nGroup delay at selected frequencies:")
for i, freq in enumerate(frequencies):
    print(f"  {freq} Hz: {group_delays[i]:.2f} samples ({group_delays[i]/audio_params['sample_rate']*1000:.2f} ms)")

# Performance assessment
if all(abs(response) < 3 for response in responses):  # Within 3dB tolerance
    performance_quality = "Flat response - well-designed"
elif all(abs(response) < 10 for response in responses):
    performance_quality = "Modest ripple - acceptable performance"
else:
    performance_quality = "High ripple - may cause audible artifacts"

print(f"\nPerformance assessment: {performance_quality}")

# Processing latency considerations
processing_latency_samples = audio_params['buffer_size'] / 2  # Typical for FIR or IIR
processing_latency_ms = processing_latency_samples / audio_params['sample_rate'] * 1000

print(f"Processing latency: {processing_latency_ms:.2f} ms")
print(f"Real-time capability: {'Yes' if processing_latency_ms < 10 else 'Maybe' if processing_latency_ms < 30 else 'No (too high)'}")

Real-Time Processing Requirements

Meeting constraints for audio applications.


Your Challenge: Control System Stability Analysis

Analyze the stability of a feedback control system and determine the range of controller gains that ensure stable operation.

Goal: Apply system analysis techniques to determine controller parameters for stable closed-loop operation.

Control System Parameters

import math

# Feedback control system for DC motor speed control
control_system = {
    'plant_transfer_function': 'K / (s(s+a)(s+b))',  # DC motor: 2 poles + integrator
    'controller_type': 'PID',  # P, PI, PD, or PID
    'plant_gain': 50,         # Motor gain constant
    'time_constants': [0.1, 0.05],  # Time constants for poles (a=1/0.1=10, b=1/0.05=20)
    'sampling_rate': 1000,     # Hz (digital control)
    'desired_bandwidth': 20,   # Hz (closed-loop bandwidth requirement)
    'phase_margin': 45,        # degrees (stability requirement)
    'gain_margin': 6,          # dB (stability requirement)
    'disturbance_rejection': True  # Requirement for disturbance rejection
}

# Calculate plant parameters
K_motor = control_system['plant_gain']
a = 1 / control_system['time_constants'][0]  # s⁻¹
b = 1 / control_system['time_constants'][1]  # s⁻¹

# Plant transfer function: G(s) = K / [s(s+a)(s+b)]
# = K / [s³ + (a+b)s² + ab*s]

# For PID controller: C(s) = Kp + Ki/s + Kd*s = (Kd*s² + Kp*s + Ki) / s
# Overall open-loop: L(s) = C(s)*G(s) = K*(Kd*s² + Kp*s + Ki) / [s²(s+a)(s+b)]

# Calculate desired closed-loop characteristics
desired_nat_freq = control_system['desired_bandwidth'] * 2 * math.pi  # Convert to rad/s
desired_damping = math.cos(math.radians(90 - control_system['phase_margin']))  # For phase margin

# For second-order approximation with PID control
# We want characteristic equation to have desired poles
# s² + 2*zeta*wn*s + wn² = 0

# Use Routh-Hurwitz criterion for stability
# Characteristic equation: 1 + L(s) = 0
# 1 + [K_motor * (Kd*s² + Kp*s + Ki)] / [s²(s+a)(s+b)] = 0
# s²(s+a)(s+b) + K_motor*(Kd*s² + Kp*s + Ki) = 0
# s⁴ + (a+b)s³ + ab*s² + K_motor*Kd*s² + K_motor*Kp*s + K_motor*Ki = 0
# s⁴ + (a+b)s³ + (ab + K_motor*Kd)s² + K_motor*Kp*s + K_motor*Ki = 0

# Routh array for 4th order system:
# s⁴: 1 | (ab + K*Kd) | K*Ki
# s³: (a+b) | K*Kp | 0
# s²: b1 | K*Ki | 0
# s¹: c1 | 0 | 0
# s⁰: K*Ki | 0 | 0

# Where b1 = [(a+b)(ab + K*Kd) - K*Kp] / (a+b)
# c1 = [b1*K*Kp - (a+b)*K*Ki] / b1

# For stability: All elements in first column must be positive

# Calculate stability conditions
R1 = 1  # Always positive
R2 = a + b  # Always positive
R3 = ((a + b) * (a*b + K_motor * 1 * 0) - K_motor * 1 * 0) / (a + b)  # Using placeholder values for now

# Using root locus approach to determine stable gain ranges
# For the open loop transfer function with PI controller (Kd = 0):
# L(s) = K_motor * (Kp + Ki/s) / [s(s+a)(s+b)] = K_motor * (Kp*s + Ki) / [s²(s+a)(s+b)]

# To find gain margin and phase margin, we need frequency response
# Calculate gain crossover frequency where |L(jw)| = 1
# Calculate phase at gain crossover frequency - should be > -180° + phase_margin for stability

# For now, let's focus on calculating required gains for desired performance
# Using pole placement for a simplified second-order system equivalent:

# Desired characteristic equation: s² + 2*zeta*wn*s + wn²
# For the third-order system we need to place poles appropriately
# One approach: dominant second-order with additional pole at higher frequency

# Place poles at: -ζωn ± jωn√(1-ζ²), -ωn*k (where k > 1 for separation)
dominant_poles_real_part = -desired_damping * desired_nat_freq
dominant_poles_imag_part = desired_nat_freq * math.sqrt(1 - desired_damping**2)
third_pole_location = -desired_nat_freq * 3  # 3x separation

print(f"Control system analysis:")
print(f"  Plant gain: {K_motor}")
print(f"  Pole locations: -{a}, -{b}, 0 (integrator)")
print(f"  Desired natural frequency: {desired_nat_freq:.2f} rad/s ({desired_nat_freq/(2*math.pi):.2f} Hz)")
print(f"  Desired damping ratio: {desired_damping:.3f}")
print(f"  Desired closed-loop poles: {dominant_poles_real_part:.2f}±{dominant_poles_imag_part:.2f}j, {third_pole_location:.2f}")
print(f"  Phase margin target: {control_system['phase_margin']}°")
print(f"  Gain margin target: {control_system['gain_margin']} dB")

# Calculate approximate PID gains using pole placement (simplified approach)
# For a DC motor with PI control, good starting point:
# Kp = (2*zeta*wn*a*b) / K - 1  # Proportional gain
# Ki = wn² * a * b / K  # Integral gain

Kp_calculated = (2 * desired_damping * desired_nat_freq * a * b) / K_motor - a - b
Ki_calculated = (desired_nat_freq**2 * a * b) / K_motor
Kd_calculated = 0  # For initial PI design

if Kp_calculated < 0:
    # Adjust for practical values
    Kp_calculated = desired_nat_freq / 10  # Empirical adjustment
    Ki_calculated = (desired_nat_freq**2) / 10

# For PID with derivative action to improve stability margins:
# Add derivative term to improve phase margin
Kd_calculated = 0.1 * Kp_calculated  # Empirical, typically 0.1-0.2 * Kp

ELI10 Explanation

Simple analogy for better understanding

Think of signals and systems like understanding how sound travels through different musical instruments and venues. A signal is like a musical note - it's information that changes over time (like how a piano note starts loud and fades away). A system is like a musical instrument or concert hall that changes the sound (like how a guitar modifies the string vibration to make it louder and richer). Fourier transforms are like a magical music analyzer that can break down any complex sound into its basic musical notes (frequencies), just like how a prism breaks white light into different colors. The Laplace transform is like a more advanced version that can handle not just pure tones but also sounds that fade in and out over time. Stability is like checking if a guitar stays in tune - if you pluck a string, does it make a nice musical sound that settles down, or does it go crazy and buzz and echo forever? Understanding signals and systems helps engineers design everything from audio equipment to radio communication systems to filters that remove noise from medical equipment recordings.

Self-Examination

Q1.

How do Fourier series and transforms convert time-domain signals to frequency-domain representations?

Q2.

What is the significance of poles and zeros in system stability analysis?

Q3.

How do convolution and correlation operations relate to system response?