Skip to content
Published on

Engineering Mathematics 2: Fourier Series, Fourier Transform & PDE

Authors

Engineering Mathematics 2: Fourier Series/Transform and Partial Differential Equations (PDE)

The mathematical foundation of signal processing, communication systems, and electromagnetics is undoubtedly Fourier Analysis. The remarkable fact that any periodic signal can be expressed as a sum of sines and cosines is the core of modern engineering. This article systematically covers Fourier series through FFT and partial differential equations.


1. Fourier Series

1.1 The Core Idea

In 1807, Joseph Fourier made a remarkable claim while solving the heat equation: any periodic function can be expressed as an infinite series of trigonometric functions.

Fourier series of a function f(x)f(x) with period 2L2L:

f(x)=a02+n=1(ancosnπxL+bnsinnπxL)f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n\cos\frac{n\pi x}{L} + b_n\sin\frac{n\pi x}{L}\right)

Fourier coefficients:

a0=1LLLf(x)dxa_0 = \frac{1}{L}\int_{-L}^{L}f(x)\,dx

an=1LLLf(x)cosnπxLdx(n=1,2,3,)a_n = \frac{1}{L}\int_{-L}^{L}f(x)\cos\frac{n\pi x}{L}\,dx \quad (n = 1, 2, 3, \ldots)

bn=1LLLf(x)sinnπxLdx(n=1,2,3,)b_n = \frac{1}{L}\int_{-L}^{L}f(x)\sin\frac{n\pi x}{L}\,dx \quad (n = 1, 2, 3, \ldots)

Orthogonality: This formula works because of the orthogonality of trigonometric functions.

LLcosmπxLcosnπxLdx={2Lm=n=0Lm=n00mn\int_{-L}^{L}\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}\,dx = \begin{cases} 2L & m = n = 0 \\ L & m = n \neq 0 \\ 0 & m \neq n \end{cases}

LLsinmπxLsinnπxLdx={Lm=n0mn\int_{-L}^{L}\sin\frac{m\pi x}{L}\sin\frac{n\pi x}{L}\,dx = \begin{cases} L & m = n \\ 0 & m \neq n \end{cases}

LLcosmπxLsinnπxLdx=0(always)\int_{-L}^{L}\cos\frac{m\pi x}{L}\sin\frac{n\pi x}{L}\,dx = 0 \quad (\text{always})

1.2 Square Wave Expansion

Problem: A square wave with period 2π2\pi

f(x)={10<x<π1π<x<0f(x) = \begin{cases} 1 & 0 < x < \pi \\ -1 & -\pi < x < 0 \end{cases}

Calculation:

Since f(x)f(x) is an odd function, an=0a_n = 0 for n0n \geq 0.

bn=1πππf(x)sin(nx)dx=2π0πsin(nx)dxb_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)\,dx = \frac{2}{\pi}\int_0^{\pi}\sin(nx)\,dx

=2π[cos(nx)n]0π=2nπ(1cosnπ)={4nπn odd0n even= \frac{2}{\pi}\left[-\frac{\cos(nx)}{n}\right]_0^{\pi} = \frac{2}{n\pi}(1 - \cos n\pi) = \begin{cases} \frac{4}{n\pi} & n \text{ odd} \\ 0 & n \text{ even} \end{cases}

Result: f(x)=4π(sinx+13sin3x+15sin5x+)=4πk=0sin(2k+1)x2k+1f(x) = \frac{4}{\pi}\left(\sin x + \frac{1}{3}\sin 3x + \frac{1}{5}\sin 5x + \cdots\right) = \frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\sin(2k+1)x}{2k+1}

Even with just the first few terms, the sum approaches the square wave increasingly closely. This is the power of the Fourier series.

Leibniz formula: Substituting x=π/2x = \pi/2: π4=113+1517+\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots

1.3 Triangle Wave Expansion

f(x)=x,πxπf(x) = |x|, \quad -\pi \leq x \leq \pi

Since it is an even function, bn=0b_n = 0.

a0=2π0πxdx=πa_0 = \frac{2}{\pi}\int_0^{\pi} x\,dx = \pi

an=2π0πxcos(nx)dx=2π[xsin(nx)n+cos(nx)n2]0πa_n = \frac{2}{\pi}\int_0^{\pi} x\cos(nx)\,dx = \frac{2}{\pi}\left[\frac{x\sin(nx)}{n} + \frac{\cos(nx)}{n^2}\right]_0^{\pi}

=2n2π(cosnπ1)={4n2πn odd0n even= \frac{2}{n^2\pi}(\cos n\pi - 1) = \begin{cases} -\frac{4}{n^2\pi} & n \text{ odd} \\ 0 & n \text{ even} \end{cases}

Result: f(x)=π24π(cosx+cos3x9+cos5x25+)f(x) = \frac{\pi}{2} - \frac{4}{\pi}\left(\cos x + \frac{\cos 3x}{9} + \frac{\cos 5x}{25} + \cdots\right)

Unlike the square wave, the coefficients decrease rapidly as n2n^2, giving faster convergence.

1.4 Convergence and the Gibbs Phenomenon

Dirichlet Conditions:

A function f(x)f(x) converges in its Fourier series if:

  1. Absolutely integrable over one period: LLf(x)dx<\int_{-L}^{L}|f(x)|\,dx < \infty
  2. Finite number of extrema within one period
  3. Finite number of discontinuities within one period

At a point of discontinuity, the series converges to the average of the left and right limits: f(x0)=f(x0)+f(x0+)2f(x_0) = \frac{f(x_0^-) + f(x_0^+)}{2}

Gibbs Phenomenon: Near discontinuities, overshoot occurs when summing a finite number of terms. No matter how many terms are added, approximately 8.9% overshoot near discontinuities persists.

Overshoot1π0πsinttdt120.0895\text{Overshoot} \approx \frac{1}{\pi}\int_0^{\pi}\frac{\sin t}{t}\,dt - \frac{1}{2} \approx 0.0895

This is the mathematical cause of the ringing phenomenon in square-wave filters.

1.5 Complex Fourier Series

Using Euler's formula:

f(x)=n=cneinπx/Lf(x) = \sum_{n=-\infty}^{\infty}c_n e^{in\pi x/L}

Complex coefficients: cn=12LLLf(x)einπx/Ldxc_n = \frac{1}{2L}\int_{-L}^{L}f(x)e^{-in\pi x/L}\,dx

Relationship with ana_n, bnb_n: cn=anibn2,cn=an+ibn2(n>0)c_n = \frac{a_n - ib_n}{2}, \quad c_{-n} = \frac{a_n + ib_n}{2} \quad (n > 0)

Parseval's Theorem (energy conservation):

12LLLf(x)2dx=n=cn2=a024+12n=1(an2+bn2)\frac{1}{2L}\int_{-L}^{L}|f(x)|^2\,dx = \sum_{n=-\infty}^{\infty}|c_n|^2 = \frac{|a_0|^2}{4} + \frac{1}{2}\sum_{n=1}^{\infty}(|a_n|^2 + |b_n|^2)

The energy in the time domain equals the energy in the frequency domain.

Basel problem application: Applying Parseval's theorem to the triangle wave: n=1,3,5,1n4=π496\sum_{n=1,3,5,\ldots}\frac{1}{n^4} = \frac{\pi^4}{96}


2. Fourier Transform

2.1 From Periodic to Aperiodic Functions

Taking the period 2L2L to LL \to \infty, the Fourier series develops into the Fourier transform.

Fourier Transform (time to frequency): F(ω)=F{f(t)}=f(t)eiωtdtF(\omega) = \mathcal{F}\{f(t)\} = \int_{-\infty}^{\infty}f(t)e^{-i\omega t}\,dt

Inverse Fourier Transform (frequency to time): f(t)=F1{F(ω)}=12πF(ω)eiωtdωf(t) = \mathcal{F}^{-1}\{F(\omega)\} = \frac{1}{2\pi}\int_{-\infty}^{\infty}F(\omega)e^{i\omega t}\,d\omega

Expression using frequency ff (commonly used in engineering): F(f)=f(t)ei2πftdt,f(t)=F(f)ei2πftdfF(f) = \int_{-\infty}^{\infty}f(t)e^{-i2\pi ft}\,dt, \quad f(t) = \int_{-\infty}^{\infty}F(f)e^{i2\pi ft}\,df

2.2 Key Transform Pairs

Rectangular pulse:

f(t)={1t<T/20t>T/2f(t) = \begin{cases} 1 & |t| < T/2 \\ 0 & |t| > T/2 \end{cases}

F(ω)=T/2T/2eiωtdt=2sin(ωT/2)ω=Tsinc ⁣(ωT2π)F(\omega) = \int_{-T/2}^{T/2}e^{-i\omega t}\,dt = \frac{2\sin(\omega T/2)}{\omega} = T\,\text{sinc}\!\left(\frac{\omega T}{2\pi}\right)

A finite pulse in the time domain becomes a sinc function in the frequency domain.

Uncertainty principle: The product of the time width and bandwidth has a lower bound. ΔtΔω12\Delta t \cdot \Delta\omega \geq \frac{1}{2}

A shorter pulse (higher time resolution) has wider bandwidth (lower frequency resolution).

Gaussian function: Self-dual transform pair

f(t)=eat2F(ω)=πaeω2/(4a)f(t) = e^{-at^2} \Leftrightarrow F(\omega) = \sqrt{\frac{\pi}{a}}e^{-\omega^2/(4a)}

The Fourier transform of a Gaussian is again a Gaussian.

Dirac Delta Function:

δ(t)=0(t0),δ(t)dt=1\delta(t) = 0 \,(t \neq 0), \quad \int_{-\infty}^{\infty}\delta(t)\,dt = 1

F{δ(t)}=1\mathcal{F}\{\delta(t)\} = 1

The frequency spectrum of an impulse is uniform at all frequencies (similar to white noise).

F{1}=2πδ(ω)\mathcal{F}\{1\} = 2\pi\delta(\omega)

A pure DC signal has energy only at ω=0\omega = 0.

2.3 Key Properties

Linearity: F{af(t)+bg(t)}=aF(ω)+bG(ω)\mathcal{F}\{af(t) + bg(t)\} = aF(\omega) + bG(\omega)

Time shift: F{f(tt0)}=eiωt0F(ω)\mathcal{F}\{f(t-t_0)\} = e^{-i\omega t_0}F(\omega)

Delay changes only the phase, not the magnitude.

Frequency shift (modulation): F{eiω0tf(t)}=F(ωω0)\mathcal{F}\{e^{i\omega_0 t}f(t)\} = F(\omega - \omega_0)

Time scaling: F{f(at)}=1aF ⁣(ωa)\mathcal{F}\{f(at)\} = \frac{1}{|a|}F\!\left(\frac{\omega}{a}\right)

Compressing a signal in time widens its bandwidth.

Differentiation: F{f(n)(t)}=(iω)nF(ω)\mathcal{F}\{f^{(n)}(t)\} = (i\omega)^n F(\omega)

Differentiation becomes multiplication in the frequency domain. ODEs become algebraic equations!

Integration: F{tf(τ)dτ}=F(ω)iω+πF(0)δ(ω)\mathcal{F}\left\{\int_{-\infty}^{t}f(\tau)\,d\tau\right\} = \frac{F(\omega)}{i\omega} + \pi F(0)\delta(\omega)

Convolution theorem (core of signal processing): F{(fg)(t)}=F(ω)G(ω)\mathcal{F}\{(f*g)(t)\} = F(\omega) \cdot G(\omega)

where (fg)(t)=f(τ)g(tτ)dτ\text{where } (f*g)(t) = \int_{-\infty}^{\infty}f(\tau)g(t-\tau)\,d\tau

In linear time-invariant (LTI) systems: output = convolution of input with impulse response. In the frequency domain, this is just multiplication!

Parseval's theorem (energy conservation): f(t)2dt=12πF(ω)2dω\int_{-\infty}^{\infty}|f(t)|^2\,dt = \frac{1}{2\pi}\int_{-\infty}^{\infty}|F(\omega)|^2\,d\omega

2.4 Application: Filter Design

Ideal Low-Pass Filter (LPF):

H(ω)={1ωωc0ω>ωcH(\omega) = \begin{cases} 1 & |\omega| \leq \omega_c \\ 0 & |\omega| > \omega_c \end{cases}

Impulse response: h(t)=F1{H(ω)}=ωcπsinc ⁣(ωctπ)h(t) = \mathcal{F}^{-1}\{H(\omega)\} = \frac{\omega_c}{\pi}\text{sinc}\!\left(\frac{\omega_c t}{\pi}\right)

Non-causal (requires future samples), so cannot be implemented in practice. Practical filters (Butterworth, Chebyshev, etc.) are used.

Bandpass filter:

H(ω)=HLPF(ωω0)+HLPF(ω+ω0)H(\omega) = H_{LPF}(\omega - \omega_0) + H_{LPF}(\omega + \omega_0)

Impulse response: h(t)=2hLPF(t)cosω0th(t) = 2h_{LPF}(t)\cos\omega_0 t

Frequency Response:

When eiωte^{i\omega t} is input to an LTI system: y(t)=H(ω)eiωty(t) = H(\omega)e^{i\omega t}

H(ω)H(\omega) simultaneously represents complex magnitude (gain) and phase shift: H(ω)=H(ω)eiH(ω)H(\omega) = |H(\omega)|e^{i\angle H(\omega)}


3. Discrete Fourier Transform (DFT) and FFT

3.1 DFT Definition

For NN discrete samples x[0],x[1],,x[N1]x[0], x[1], \ldots, x[N-1]:

X[k]=n=0N1x[n]ej2πkn/N,k=0,1,,N1X[k] = \sum_{n=0}^{N-1}x[n]e^{-j2\pi kn/N}, \quad k = 0, 1, \ldots, N-1

x[n]=1Nk=0N1X[k]ej2πkn/N,n=0,1,,N1x[n] = \frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi kn/N}, \quad n = 0, 1, \ldots, N-1

Twiddle factor: WN=ej2π/NW_N = e^{-j2\pi/N}

X[k]=n=0N1x[n]WNknX[k] = \sum_{n=0}^{N-1}x[n]W_N^{kn}

Frequency resolution: Δf=fs/N\Delta f = f_s / N (sampling frequency divided by N)

Nyquist limit: fs2fmaxf_s \geq 2 f_{max} (to prevent aliasing)

3.2 FFT Algorithm (Cooley-Tukey Algorithm)

Direct DFT computation: O(N2)O(N^2) complexity

FFT (Fast Fourier Transform): O(Nlog2N)O(N\log_2 N) complexity

For N=210=1024N = 2^{10} = 1024:

  • DFT: 102421061024^2 \approx 10^6 operations
  • FFT: 1024×101041024 \times 10 \approx 10^4 operations — 100x faster

Divide and conquer principle (decimation-in-time):

Separate into even/odd indices:

X[k]=n=0N/21x[2n]WN2kn+WNkn=0N/21x[2n+1]WN2knX[k] = \sum_{n=0}^{N/2-1}x[2n]W_N^{2kn} + W_N^k\sum_{n=0}^{N/2-1}x[2n+1]W_N^{2kn}

=E[k]+WNkO[k]= E[k] + W_N^k O[k]

Since WN2=WN/2W_N^2 = W_{N/2}, E[k]E[k] and O[k]O[k] are each N/2N/2-point DFTs.

Applying this recursively gives O(NlogN)O(N\log N).

3.3 FFT Implementation and Signal Analysis with Python

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal as sig

# Generate composite signal (50 Hz + 120 Hz mixed)
fs = 1000  # Sampling frequency (Hz)
T = 1.0    # Signal length (seconds)
N = int(fs * T)
t = np.linspace(0, T, N, endpoint=False)

# Signal: 50 Hz (amplitude 1.0) + 120 Hz (amplitude 0.5) + noise
np.random.seed(42)
signal_clean = (np.sin(2 * np.pi * 50 * t) +
                0.5 * np.sin(2 * np.pi * 120 * t))
noise = 0.2 * np.random.randn(N)
signal_noisy = signal_clean + noise

# Perform FFT
fft_result = np.fft.fft(signal_noisy)
freqs = np.fft.fftfreq(N, 1/fs)

# Two-sided spectrum -> one-sided spectrum
magnitude = (2.0 / N) * np.abs(fft_result[:N//2])
freqs_pos = freqs[:N//2]

# Visualization
fig, axes = plt.subplots(3, 1, figsize=(12, 10))

axes[0].plot(t[:200], signal_noisy[:200], 'b-', alpha=0.7)
axes[0].plot(t[:200], signal_clean[:200], 'r-', linewidth=2)
axes[0].set_xlabel('Time (s)')
axes[0].set_ylabel('Amplitude')
axes[0].set_title('Time Domain Signal (blue: with noise, red: clean signal)')
axes[0].legend(['Noisy', 'Clean'])
axes[0].grid(True, alpha=0.3)

axes[1].plot(freqs_pos, magnitude, 'g-')
axes[1].set_xlabel('Frequency (Hz)')
axes[1].set_ylabel('Amplitude Spectrum')
axes[1].set_title('Frequency Domain (FFT Magnitude)')
axes[1].set_xlim([0, 200])
axes[1].grid(True, alpha=0.3)

# Spectrogram
f_spec, t_spec, Sxx = sig.spectrogram(signal_noisy, fs, nperseg=64)
axes[2].pcolormesh(t_spec, f_spec, 10*np.log10(Sxx + 1e-10), shading='gouraud')
axes[2].set_ylabel('Frequency (Hz)')
axes[2].set_xlabel('Time (s)')
axes[2].set_title('Spectrogram')
axes[2].set_ylim([0, 200])

plt.tight_layout()
plt.savefig('fft_analysis.png', dpi=150)
plt.show()

# Print dominant frequency components
peak_indices = np.where(magnitude > 0.1)[0]
print("Dominant frequency components:")
for idx in peak_indices:
    print(f"  {freqs_pos[idx]:.1f} Hz: amplitude {magnitude[idx]:.3f}")

3.4 Signal Filtering with FFT

import numpy as np
import matplotlib.pyplot as plt

def fft_lowpass_filter(signal_in, fs, cutoff_freq):
    """FFT-based ideal low-pass filter"""
    N = len(signal_in)
    fft_result = np.fft.fft(signal_in)
    freqs = np.fft.fftfreq(N, 1/fs)

    # Zero out components above cutoff frequency
    fft_filtered = fft_result.copy()
    fft_filtered[np.abs(freqs) > cutoff_freq] = 0

    # Inverse transform
    return np.real(np.fft.ifft(fft_filtered))

# Filtering example
fs = 1000
t = np.linspace(0, 1, fs, endpoint=False)
signal_in = (np.sin(2 * np.pi * 50 * t) +
             0.3 * np.sin(2 * np.pi * 200 * t) +
             0.1 * np.random.randn(fs))

filtered = fft_lowpass_filter(signal_in, fs, cutoff_freq=80)

plt.figure(figsize=(10, 5))
plt.plot(t[:200], signal_in[:200], 'b-', alpha=0.5, label='Original signal')
plt.plot(t[:200], filtered[:200], 'r-', linewidth=2, label='Filtered signal (80Hz LPF)')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.title('FFT-Based Low-Pass Filtering')
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()

4. Partial Differential Equations (PDE)

4.1 PDE Classification

Second-order linear PDE: Auxx+Buxy+Cuyy+Dux+Euy+Fu=GAu_{xx} + Bu_{xy} + Cu_{yy} + Du_x + Eu_y + Fu = G

Based on discriminant B24ACB^2 - 4AC:

ConditionClassificationRepresentative Equation
B24AC<0B^2 - 4AC < 0EllipticLaplace equation
B24AC=0B^2 - 4AC = 0ParabolicHeat equation
B24AC>0B^2 - 4AC > 0HyperbolicWave equation

4.2 Separation of Variables

Basic idea: Assume u(x,t)=X(x)T(t)u(x,t) = X(x)T(t) to separate the PDE into two ODEs.

4.3 Heat Equation

Physical background: Heat conduction in a rod

ut=c22ux2,0<x<L,t>0\frac{\partial u}{\partial t} = c^2\frac{\partial^2 u}{\partial x^2}, \quad 0 < x < L, \quad t > 0

Boundary conditions: u(0,t)=0u(0,t) = 0, u(L,t)=0u(L,t) = 0 (both ends fixed at temperature 0)

Initial condition: u(x,0)=f(x)u(x,0) = f(x)

Solution procedure:

Substituting u=X(x)T(t)u = X(x)T(t):

XT=c2XTXT' = c^2 X''T

Tc2T=XX=λ\frac{T'}{c^2 T} = \frac{X''}{X} = -\lambda

The separation constant λ-\lambda is determined by the boundary conditions.

X equation: X+λX=0X'' + \lambda X = 0, X(0)=X(L)=0X(0) = X(L) = 0

Eigenvalue problem: λn=(nπ/L)2\lambda_n = (n\pi/L)^2, eigenfunctions: Xn(x)=sin(nπx/L)X_n(x) = \sin(n\pi x/L)

T equation: T+c2λnT=0T' + c^2\lambda_n T = 0

Tn(t)=ec2(nπ/L)2tT_n(t) = e^{-c^2(n\pi/L)^2 t}

General solution (superposition principle):

u(x,t)=n=1bnsinnπxLec2(nπ/L)2tu(x,t) = \sum_{n=1}^{\infty}b_n \sin\frac{n\pi x}{L} e^{-c^2(n\pi/L)^2 t}

Coefficient determination (applying t=0t=0):

u(x,0)=f(x)=n=1bnsinnπxLu(x,0) = f(x) = \sum_{n=1}^{\infty}b_n\sin\frac{n\pi x}{L}

This is a Fourier sine series, so:

bn=2L0Lf(x)sinnπxLdxb_n = \frac{2}{L}\int_0^L f(x)\sin\frac{n\pi x}{L}\,dx

Application to electronic component thermal analysis:

The heat equation is used in CPU heatsink design, power transistor heat distribution, and PCB thermal management.

Physical interpretation:

  • High-frequency modes (large nn): decay rapidly (the n2n^2 dependence in the exponential term)
  • Low-frequency mode (n=1n = 1): decays most slowly
  • Over time, heat distributes uniformly regardless of the initial distribution

4.4 Wave Equation

Physical background: Transverse vibration of a taut string

2ut2=c22ux2,0<x<L\frac{\partial^2 u}{\partial t^2} = c^2\frac{\partial^2 u}{\partial x^2}, \quad 0 < x < L

Wave speed c=T/ρc = \sqrt{T/\rho} (tension/linear mass density)

Boundary conditions: u(0,t)=u(L,t)=0u(0,t) = u(L,t) = 0 (both ends fixed)

Initial conditions: u(x,0)=f(x)u(x,0) = f(x), ut(x,0)=g(x)u_t(x,0) = g(x)

Solution (separation of variables):

u(x,t)=n=1(AncosnπctL+BnsinnπctL)sinnπxLu(x,t) = \sum_{n=1}^{\infty}\left(A_n\cos\frac{n\pi ct}{L} + B_n\sin\frac{n\pi ct}{L}\right)\sin\frac{n\pi x}{L}

Coefficient determination: An=2L0Lf(x)sinnπxLdxA_n = \frac{2}{L}\int_0^L f(x)\sin\frac{n\pi x}{L}\,dx

Bn=2nπc0Lg(x)sinnπxLdxB_n = \frac{2}{n\pi c}\int_0^L g(x)\sin\frac{n\pi x}{L}\,dx

d'Alembert Solution:

For the case of initial displacement only and zero initial velocity: u(x,t)=12[f(x+ct)+f(xct)]u(x,t) = \frac{1}{2}[f(x+ct) + f(x-ct)]

This is the superposition of traveling waves — the sum of a wave moving to the right by ctct and a wave moving to the left.

Standing Wave:

un(x,t)=AncosnπctLsinnπxLu_n(x,t) = A_n\cos\frac{n\pi ct}{L}\sin\frac{n\pi x}{L}

Nodes: points where sin(nπx/L)=0\sin(n\pi x/L) = 0 — at x=0,L/n,2L/n,,Lx = 0, L/n, 2L/n, \ldots, L

Antinodes: points where sin(nπx/L)=1|\sin(n\pi x/L)| = 1

Electromagnetic wave propagation: Wave equation on a transmission line:

2Vx2=LC2Vt2\frac{\partial^2 V}{\partial x^2} = LC\frac{\partial^2 V}{\partial t^2}

Where cem=1/LCc_{em} = 1/\sqrt{LC} (per-unit-length inductance/capacitance).

4.5 Laplace Equation

2u=2ux2+2uy2=0\nabla^2 u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0

Physical meaning: Steady-state (time-invariant) heat distribution, electrostatic potential, velocity potential in incompressible flow.

Rectangular domain (0xa0 \leq x \leq a, 0yb0 \leq y \leq b):

Boundary conditions: u(0,y)=0,u(a,y)=0,u(x,0)=0,u(x,b)=f(x)u(0,y) = 0, \quad u(a,y) = 0, \quad u(x,0) = 0, \quad u(x,b) = f(x)

Solution:

Separating u=X(x)Y(y)u = X(x)Y(y):

XX=YY=λ\frac{X''}{X} = -\frac{Y''}{Y} = -\lambda

X equation: X+λX=0X'' + \lambda X = 0, X(0)=X(a)=0X(0) = X(a) = 0

λn=(nπa)2,Xn=sinnπxa\lambda_n = \left(\frac{n\pi}{a}\right)^2, \quad X_n = \sin\frac{n\pi x}{a}

Y equation: YλnY=0Y'' - \lambda_n Y = 0, Y(0)=0Y(0) = 0

Yn=sinhnπyaY_n = \sinh\frac{n\pi y}{a}

General solution: u(x,y)=n=1cnsinhnπyasinnπxau(x,y) = \sum_{n=1}^{\infty}c_n\sinh\frac{n\pi y}{a}\sin\frac{n\pi x}{a}

At y=by = b: cn=2asinh(nπb/a)0af(x)sinnπxadxc_n = \frac{2}{a\sinh(n\pi b/a)}\int_0^a f(x)\sin\frac{n\pi x}{a}\,dx

Electrostatic application: Potential distribution between two conducting plates, electric field analysis between PCB traces.

4.6 Numerical PDE Solutions with Python

Solving the heat equation with the Finite Difference Method:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation

def solve_heat_equation_fd(L, T_total, Nx, Nt, c, initial_func):
    """
    Numerical solution of heat equation using finite difference method
    u_t = c^2 * u_xx
    Boundary conditions: u(0,t) = u(L,t) = 0
    """
    dx = L / (Nx - 1)
    dt = T_total / (Nt - 1)

    # Check stability condition (CFL condition)
    r = c**2 * dt / dx**2
    if r > 0.5:
        print(f"Warning: r = {r:.3f} > 0.5, may be unstable!")
    else:
        print(f"r = {r:.3f} (stability condition satisfied)")

    x = np.linspace(0, L, Nx)
    u = initial_func(x)
    u[0] = u[-1] = 0  # Boundary conditions

    u_history = [u.copy()]

    for _ in range(Nt - 1):
        u_new = u.copy()
        u_new[1:-1] = u[1:-1] + r * (u[2:] - 2*u[1:-1] + u[:-2])
        u_new[0] = u_new[-1] = 0
        u = u_new
        u_history.append(u.copy())

    return x, np.array(u_history)

# Parameter setup
L = 1.0       # Rod length (m)
T_total = 0.1 # Simulation time (s)
c = 1.0       # Thermal diffusivity

def initial_temp(x):
    """Initial temperature distribution (half sine wave)"""
    return np.sin(np.pi * x / L)

Nx, Nt = 50, 500
x, u_hist = solve_heat_equation_fd(L, T_total, Nx, Nt, c, initial_temp)

# Visualization
t_points = np.linspace(0, T_total, Nt)
t_indices = [0, Nt//10, Nt//4, Nt//2, Nt-1]

plt.figure(figsize=(10, 6))
for idx in t_indices:
    plt.plot(x, u_hist[idx],
             label=f't = {t_points[idx]:.3f} s')

plt.xlabel('Position x (m)')
plt.ylabel('Temperature u(x,t)')
plt.title('Heat Equation Numerical Solution - Finite Difference Method')
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('heat_equation.png', dpi=150)
plt.show()

# Compare with analytical solution
print("\nAnalytical vs numerical comparison (t=0.05, n=1 term):")
t_check = 0.05
idx_check = int(t_check / T_total * (Nt - 1))
u_analytical = np.sin(np.pi * x / L) * np.exp(-c**2 * (np.pi/L)**2 * t_check)
max_error = np.max(np.abs(u_hist[idx_check] - u_analytical))
print(f"Maximum error: {max_error:.6f}")

Solving the Laplace equation (static potential) with finite difference:

import numpy as np
import matplotlib.pyplot as plt

def solve_laplace_fd(Nx, Ny, boundary_func, tol=1e-6, max_iter=10000):
    """
    Solving Laplace equation using Gauss-Seidel iteration
    """
    u = np.zeros((Ny, Nx))
    x = np.linspace(0, 1, Nx)
    y = np.linspace(0, 1, Ny)

    # Set boundary conditions
    for j in range(Nx):
        u[0, j] = 0              # Bottom boundary
        u[-1, j] = np.sin(np.pi * x[j])  # Top boundary
    for i in range(Ny):
        u[i, 0] = 0              # Left boundary
        u[i, -1] = 0             # Right boundary

    # Iteration
    for iteration in range(max_iter):
        u_old = u.copy()
        # Update interior points
        u[1:-1, 1:-1] = 0.25 * (u[2:, 1:-1] + u[:-2, 1:-1] +
                                  u[1:-1, 2:] + u[1:-1, :-2])
        # Re-apply boundary conditions
        u[0, :] = 0
        u[-1, :] = np.sin(np.pi * x)
        u[:, 0] = 0
        u[:, -1] = 0

        # Check convergence
        residual = np.max(np.abs(u - u_old))
        if residual < tol:
            print(f"Converged: residual {residual:.2e} after {iteration+1} iterations")
            break

    return x, y, u

x, y, u = solve_laplace_fd(50, 50, None)
X, Y = np.meshgrid(x, y)

plt.figure(figsize=(10, 8))
plt.subplot(1, 2, 1)
plt.contourf(X, Y, u, 20, cmap='hot')
plt.colorbar(label='Potential (V)')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Laplace Equation - Equipotential Lines')

plt.subplot(1, 2, 2)
plt.contour(X, Y, u, 20)
# Electric field vector (negative gradient of potential)
Ey, Ex = np.gradient(-u)
plt.quiver(X[::4, ::4], Y[::4, ::4],
           Ex[::4, ::4], Ey[::4, ::4],
           alpha=0.7)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Electric Field Vectors')

plt.tight_layout()
plt.savefig('laplace_solution.png', dpi=150)
plt.show()

5. Laplace Transform and PDE, Introduction to Z-Transform

5.1 Solving PDE with the Laplace Transform

Applying the Laplace transform to the heat equation with respect to the time variable:

ut=c22ux2\frac{\partial u}{\partial t} = c^2\frac{\partial^2 u}{\partial x^2}

sU(x,s)u(x,0)=c2d2Udx2sU(x,s) - u(x,0) = c^2\frac{d^2U}{dx^2}

This becomes a second-order ODE in xx. Solving with boundary conditions:

U(x,s)=f0ssinh(s/c2x)sinh(s/c2L)U(x,s) = \frac{f_0}{s}\frac{\sinh(\sqrt{s/c^2}\cdot x)}{\sinh(\sqrt{s/c^2}\cdot L)}

The time response can be obtained by inverse Laplace transform.

5.2 Introduction to Z-Transform (Digital Systems)

The digital counterpart of the analog Laplace transform is the Z-transform.

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

Key relationship: z=esTsz = e^{sT_s} (TsT_s: sampling period)

| Analog (Laplace) | Digital (Z-transform) | | ----------------------------------- | --------------------- | --- | --- | | ss plane | zz plane | | jωj\omega axis (stability boundary) | Unit circle z=1 | z | =1 | | Left half-plane (stable region) | Inside unit circle | | 1/s1/s (integrator) | z/(z1)z/(z-1) |

Key transform pairs:

Z{δ[n]}=1\mathcal{Z}\{\delta[n]\} = 1

Z{u[n]}=zz1(z>1)\mathcal{Z}\{u[n]\} = \frac{z}{z-1} \quad (|z| > 1)

Z{anu[n]}=zza(z>a)\mathcal{Z}\{a^n u[n]\} = \frac{z}{z-a} \quad (|z| > |a|)

Z{sinΩ0nu[n]}=zsinΩ0z22zcosΩ0+1\mathcal{Z}\{\sin\Omega_0 n \cdot u[n]\} = \frac{z\sin\Omega_0}{z^2 - 2z\cos\Omega_0 + 1}

The Z-transform will be fully covered in the next article (Part 3: Complex Analysis and Z-Transform).


6. Engineering Application: Signal Processing Pipeline

import numpy as np
import matplotlib.pyplot as plt
from scipy import signal as sig

# Complete digital signal processing pipeline example

# 1. Signal generation
fs = 8000  # Audio sampling frequency
duration = 0.5
t = np.linspace(0, duration, int(fs * duration), endpoint=False)

# 440 Hz (A4 note) + 880 Hz (A5 note) + high-frequency noise
audio = (np.sin(2 * np.pi * 440 * t) +
         0.5 * np.sin(2 * np.pi * 880 * t) +
         0.3 * np.random.randn(len(t)))

# 2. Spectrum analysis with FFT
N = len(audio)
fft_audio = np.fft.rfft(audio)
freqs = np.fft.rfftfreq(N, 1/fs)
magnitude = np.abs(fft_audio)

# 3. Butterworth filter design (pass below 1000 Hz)
sos = sig.butter(8, 1000, fs=fs, btype='low', output='sos')

# 4. Apply filter
audio_filtered = sig.sosfilt(sos, audio)

# 5. Check frequency response
w, h = sig.sosfreqz(sos, worN=2000, fs=fs)

# Visualization
fig, axes = plt.subplots(2, 2, figsize=(14, 10))

axes[0, 0].plot(t[:400], audio[:400], 'b-', alpha=0.7)
axes[0, 0].set_title('Original Signal (Time Domain)')
axes[0, 0].set_xlabel('Time (s)')
axes[0, 0].grid(True, alpha=0.3)

axes[0, 1].semilogy(freqs, magnitude)
axes[0, 1].set_title('Original Signal FFT Magnitude Spectrum')
axes[0, 1].set_xlabel('Frequency (Hz)')
axes[0, 1].set_xlim([0, 2000])
axes[0, 1].grid(True, alpha=0.3)

axes[1, 0].plot(t[:400], audio_filtered[:400], 'r-', linewidth=1.5)
axes[1, 0].set_title('Filtered Signal (1000Hz LPF)')
axes[1, 0].set_xlabel('Time (s)')
axes[1, 0].grid(True, alpha=0.3)

axes[1, 1].plot(w, 20 * np.log10(abs(h) + 1e-10), 'g-', linewidth=2)
axes[1, 1].axvline(x=1000, color='r', linestyle='--', label='Cutoff frequency')
axes[1, 1].set_title('Butterworth Filter Frequency Response')
axes[1, 1].set_xlabel('Frequency (Hz)')
axes[1, 1].set_ylabel('Magnitude (dB)')
axes[1, 1].set_xlim([0, 3000])
axes[1, 1].set_ylim([-80, 5])
axes[1, 1].legend()
axes[1, 1].grid(True, alpha=0.3)

plt.tight_layout()
plt.savefig('signal_processing_pipeline.png', dpi=150)
plt.show()

Summary and Next Steps

Topics covered in this article:

  1. Fourier series: Square/triangle wave expansion, convergence, Gibbs phenomenon, complex representation, Parseval's theorem
  2. Fourier transform: Definition, key transform pairs (rectangular pulse, Gaussian, delta function), 9 properties
  3. DFT and FFT: Definition, Cooley-Tukey algorithm, O(NlogN)O(N\log N) complexity, Python implementation
  4. PDE classification: Elliptic/Parabolic/Hyperbolic
  5. Heat equation: Separation of variables, Fourier series solution, finite difference method
  6. Wave equation: Standing waves, d'Alembert solution, electromagnetic waves
  7. Laplace equation: Rectangular domain solution, Gauss-Seidel numerical solution
  8. Introduction to Z-transform: Analog-digital correspondence

The next article will fully cover Complex Analysis and Z-Transform — using the residue theorem to solve difficult real integrals and designing digital filters with the Z-transform.


References


Quiz

Q1. What is the Gibbs phenomenon and why does it occur?

Answer: The Gibbs phenomenon is an overshoot of approximately 8.9% that occurs near discontinuities when a Fourier series is truncated to a finite number of terms. Increasing the number of terms does not eliminate this overshoot — it merely moves closer to the discontinuity.

Explanation: At a jump discontinuity, the Fourier series converges to the average of the left and right limits. The finite partial sum exhibits oscillations near the discontinuity due to the slow convergence of the series at that point. This causes ringing artifacts in square-wave signal filters, which is why windowing functions (Hamming, Hanning, etc.) are used in practice to reduce the Gibbs effect.

Q2. What is the convolution theorem in the context of Fourier transforms and why is it fundamental to signal processing?

Answer: The Fourier convolution theorem states that the Fourier transform of the convolution of two functions equals the pointwise product of their individual Fourier transforms: F{(f*g)(t)} = F(omega) * G(omega).

Explanation: In linear time-invariant (LTI) systems, the output signal is the convolution of the input with the system's impulse response in the time domain. In the frequency domain, this becomes simple multiplication H(omega) * X(omega) = Y(omega). This transforms a computationally expensive convolution operation into a simple multiplication, which is why frequency-domain filtering is used in practice: compute FFT of input, multiply by filter response, compute inverse FFT.

Q3. How is the method of separation of variables applied to solve the heat equation?

Answer: Assume u(x,t) = X(x)T(t). Substituting into the PDE and dividing by XT gives T'/(c^2T) = X''/X = -lambda (a constant). This separates into two ODEs: X'' + lambdaX = 0 (eigenvalue problem) and T' + c^2lambdaT = 0. Applying boundary conditions gives eigenvalues lambda_n = (npi/L)^2 and eigenfunctions X_n = sin(npix/L). The general solution is the superposition u(x,t) = sum of b_n * sin(npix/L) _ exp(-c^2_(npi/L)^2 * t).

Explanation: The Fourier coefficients b_n are determined from the initial condition u(x,0) = f(x) using the Fourier sine series formula. The solution shows that higher-frequency modes decay much faster (exponential factor has n^2), so the temperature distribution smooths out over time.

Q4. What is the Nyquist sampling theorem and what happens if it is violated?

Answer: The Nyquist theorem states that to faithfully reconstruct a signal, the sampling frequency must be at least twice the maximum frequency in the signal: f_s greater than or equal to 2*f_max. The frequency f_max is called the Nyquist frequency.

Explanation: If the sampling frequency is too low (f_s less than 2*f_max), aliasing occurs. High-frequency components fold back into the lower frequency range and appear as false low-frequency signals, making it impossible to recover the original signal. In practice, anti-aliasing low-pass filters are applied before sampling to remove frequency components above f_s/2.

Q5. What are the three classifications of second-order linear PDEs and what type of physical phenomena does each represent?

Answer: Second-order linear PDEs are classified by the discriminant B^2 - 4AC:

  • Elliptic (B^2 - 4AC less than 0): Laplace and Poisson equations — represent steady-state distributions such as static electric potential, steady-state temperature, and incompressible fluid flow.
  • Parabolic (B^2 - 4AC equals 0): Heat equation — represents diffusion processes that evolve over time toward a steady state.
  • Hyperbolic (B^2 - 4AC greater than 0): Wave equation — represents propagating wave phenomena such as vibrating strings, sound waves, and electromagnetic waves.

Explanation: The classification determines the appropriate numerical methods and boundary/initial condition requirements. Elliptic equations need boundary conditions on all sides; parabolic equations need initial conditions plus boundary conditions; hyperbolic equations need two initial conditions (displacement and velocity) plus boundary conditions.