1. Biophysical Foundations of Electrophysiological Quality Assessment
Electroencephalography (EEG) records minute extracellular microvolt fluctuations ($10 -
100\,\mu\text{V}$) generated by synchronized postsynaptic potentials of cortical pyramidal neurons.
Because scalp electrodes are separated from cerebral current sources by the cerebrospinal fluid, skull
bone, and galea aponeurotica, clinical EEG signals exhibit an inherently precarious signal-to-noise
ratio ($SNR$). Real-world acquisitions are constantly bombarded by non-cerebral physiological artifacts
(ocular blinks, glossokinetic potentials, electromyographic tension) and extrinsic electromagnetic
interference (50/60 Hz powerline capacitive coupling, electrode-skin contact impedance drift).
In conventional biosignal processing, automated quality screening has historically relied on rigid,
crisp thresholding (e.g., rejecting any epoch where absolute amplitude exceeds $100\,\mu\text{V}$).
However, biological systems exhibit substantial inter-individual and state-dependent variability. A
$120\,\mu\text{V}$ slow wave may represent normal Stage 3 Slow-Wave Sleep (SWS) in an adolescent, yet
indicate severe high-voltage ocular contamination or epileptiform pathology in an awake adult. Rigid
binary logic inevitably causes unacceptable rates of false alarms or improper rejection of valid
clinical epochs.
2. Mathematical Architecture of the Mamdani Fuzzy Inference System
To resolve this limitation, this simulator implements a professional-grade Mamdani Fuzzy
Inference System (FIS). Introduced by Lotfi Zadeh (1965) and adapted for control systems by
Ebrahim Mamdani (1974), fuzzy logic provides a rigorous mathematical framework for reasoning under
imprecision, gradual transitions, and multivalent truth values.
Fuzzification and Membership Functions
Continuous biological features are mapped into categorical linguistic variables across the normalized
universe of discourse $X = [0, 10]$ via parameterized trapezoidal membership functions $\mu_A(x; a, b,
c, d)$:
$$\mu_A(x; a, b, c, d) = \max\left(0, \min\left(\frac{x - a}{b - a}, 1, \frac{d - x}{d - c}\right)\right)$$
The system extracts three primary electrophysiological input metrics:
- Amplitude Index ($x_{\text{amp}}$): Derived from peak-to-peak voltage $V_{pp} =
\max(x) - \min(x)$. Categorized into:
$$\text{Low } [0, 0, 2.0, 4.0], \quad \text{Medium } [2.5, 4.5, 6.5, 8.5], \quad \text{High } [6.5,
8.5, 10, 10]$$
- Frequency Index ($x_{\text{freq}}$): Derived from the zero-crossing rate ($ZCR$),
approximating the dominant spectral rhythm:
$$\text{Slow } [0, 0, 1.8, 3.2], \quad \text{Moderate } [2.8, 4.0, 5.5, 6.8], \quad \text{Fast }
[6.0, 7.5, 10, 10]$$
- Artifact Risk Index ($x_{\text{art}}$): Quantified by combining 50 Hz powerline
energy with high-frequency electromyographic variance:
$$\text{Low } [0, 0, 2.0, 3.5], \quad \text{Moderate } [2.5, 4.0, 6.0, 7.5], \quad \text{High }
[6.5, 8.0, 10, 10]$$
Fuzzy Rule Evaluation & Min-Max Composition
The rule base consists of $K = 8$ canonical neuro-engineering rules linking input memberships to output
consequent sets $C \in \{\text{Poor}, \text{Average}, \text{Good}\}$. The antecedent conjunctions are
evaluated using the Zadeh intersection operator ($T$-norm minimum):
$$\alpha_k = \min\left(\mu_{A_k}(x_{\text{amp}}), \mu_{B_k}(x_{\text{freq}}),
\mu_{D_k}(x_{\text{art}})\right)$$
The rule firing strength $\alpha_k$ clips the corresponding output fuzzy set via Mamdani implication:
$$\mu_{C_k}'(z) = \min\left(\alpha_k, \mu_{C_k}(z)\right)$$
Individual rule outputs are aggregated into a unified fuzzy set using the maximum $S$-norm:
$$\mu_{\text{agg}}(z) = \max_{k=1}^K \mu_{C_k}'(z)$$
Centroid Defuzzification (Center of Gravity)
To obtain a definitive, crisp Signal Quality Index ($SQI$), the aggregated fuzzy distribution
$\mu_{\text{agg}}(z)$ undergoes Center-of-Gravity ($COG$) defuzzification across $M = 101$ discrete
sampling steps:
$$z_{\text{centroid}} = \frac{\int_{0}^{10} z \cdot \mu_{\text{agg}}(z) \, dz}{\int_{0}^{10}
\mu_{\text{agg}}(z) \, dz} \approx \frac{\sum_{i=1}^M z_i \cdot \mu_{\text{agg}}(z_i)}{\sum_{i=1}^M
\mu_{\text{agg}}(z_i)}$$
The resulting centroid score ranges continuously from $0.0$ (severely corrupted) to $10.0$ (flawless
diagnostic quality), categorizing signals dynamically as Poor ($z < 4.5$),
Average ($4.5 \le z < 7.0$), or Good ($z \ge 7.0$).
3. Multi-Band Waveform Superposition & Artifact Modeling
The simulated raw time-series $x(t)$ sampled at $f_s = 100\,\text{Hz}$ over a rolling window of $T =
5.0\,\text{seconds}$ ($N = 500\,\text{points}$) represents the linear summation of four physiological
oscillators, powerline hum, and intermittent muscle contractions:
$$x(t) = A_{\alpha} \sin(2\pi f_{\alpha} t) + A_{\beta} \sin(2\pi f_{\beta} t) + A_{\delta} \sin(2\pi
f_{\delta} t) + A_{\theta} \sin(2\pi f_{\theta} t) + \eta_{50\text{Hz}}(t) + \eta_{\text{EMG}}(t)$$
where $f_{\alpha} = 10.5\,\text{Hz}$, $f_{\beta} = 19.5\,\text{Hz}$, $f_{\delta} = 1.8\,\text{Hz}$, and
$f_{\theta} = 5.2\,\text{Hz}$.
- 50 Hz Electromagnetic Mains Interference: Modeled as sinusoidal capacitive
coupling accompanied by Gaussian thermal noise:
$$\eta_{50\text{Hz}}(t) = A_{\text{noise}} \left[ 0.5 \sin(2\pi \cdot 50 \cdot t) + 0.5
\xi_{\text{white}}(t) \right]$$
- Myogenic Bursts (EMG): Modeled as transient high-frequency discharges with
semi-periodic burst intervals mimicking clenching or motor unit recruitment.
4. Mathematical Derivations of Real-Time Signal Features
The zero-crossing rate ($ZCR$) provides a computationally efficient estimate of dominant frequency
without the overhead of full Fast Fourier Transforms:
$$ZCR = \frac{1}{2(N-1)} \sum_{n=1}^{N-1} \left| \operatorname{sgn}(x[n]) - \operatorname{sgn}(x[n-1])
\right|$$
The Root-Mean-Square voltage ($V_{\text{RMS}}$) provides an instantaneous measure of overall signal
power:
$$V_{\text{RMS}} = \sqrt{\frac{1}{N} \sum_{n=0}^{N-1} x[n]^2}$$
Signal-to-Noise Ratio ($SNR$) in decibels is continuously approximated from estimated cortical power
versus high-frequency noise variance:
$$\text{SNR}_{\text{dB}} = 10 \log_{10}\left(\frac{P_{\text{cortical}}}{P_{\text{noise}} +
P_{\text{artifact}} + \epsilon}\right)$$
5. Clinical Relevance in BCI & Wearable Neurotechnology
In consumer neurotechnology and clinical Brain-Computer Interfaces (BCIs), automated Signal Quality
Indexing ($SQI$) is essential for gating algorithms. Machine learning decoders (e.g., motor imagery
classifiers or P300 spellers) experience catastrophic failure when contaminated epochs are passed into
feature extractors. By applying real-time fuzzy inference, BCI systems can reject artifacts or adjust
adaptive filter gains instantly before classification.
How to Use This Interactive Laboratory
- Modulate Cortical Rhythms: Adjust the Alpha, Beta, Delta, and Theta sliders in the
control panel. Notice how dominant frequencies shift both the time-domain waveform and the active
fuzzy frequency membership category.
- Inject Impedance Noise & Muscle Bursts: Increase 50 Hz Line Interference and
Myogenic Bursts. Observe how the real-time defuzzification curve shifts toward the "Poor" region as
the Centroid Score plummets below 4.0.
- Interactive Oscilloscope Inspection: Hover or touch across the medical oscilloscope
to inspect individual sample voltages ($\mu\text{V}$) and corresponding time offsets.
- Dual-Display Canvas: The top viewport displays the clinical oscilloscope while the
bottom viewport renders the real-time Mamdani fuzzy membership curves and aggregated centroid
marker.
- Auditory Sonification: Enable sound to hear acoustic pitch-mapped translations of
cortical band powers and myogenic noise bursts.
Related Interactive Laboratories on BioniChaos
Open Access License: This interactive educational module is released under
CC BY-NC 4.0 (Attribution-NonCommercial)
for non-commercial research, academic study, and clinical education.
Commercial & Enterprise Licensing: For white-labeling, proprietary LMS/course
embedding, hardware dashboard telemetry integration, or custom feature engineering, secure a
commercial license at
BioniCloud.com or contact
Dr. Yuri Beno.