Fuzzy Logic & EEG Simulation

Overview

This interactive application simulates Electroencephalography (EEG) brain waves and demonstrates how Fuzzy Logic can be applied to classify human cognitive states. Unlike standard boolean logic (True/False), Fuzzy Logic deals with degrees of truth, making it highly suitable for noisy, continuous biological signals like EEG.

How to Use

Technical Details: EEG & Frequencies

An EEG signal is a complex waveform representing electrical brain activity. We decompose this signal into distinct frequency bands:

Technical Details: Fuzzy Logic Engine

In this simulation, we implement a Fuzzy Inference System (FIS) in JavaScript:

  1. Fuzzification: We take the crisp normalized power (0.0 to 1.0) of the Alpha and Beta bands. We pass these values through membership functions (triangles). For example, an Alpha power of 0.6 might be 20% "Medium" and 80% "High".
  2. Rule Evaluation: We apply logical rules. Example: IF Alpha is High AND Beta is Low THEN State is Relaxed. In fuzzy logic, AND is typically computed as the minimum of the two fuzzy values.
  3. Defuzzification: We aggregate the results of the rules to compute a crisp "Cognitive Alertness" score (shown as the gauge on the bottom right), using a simplified weighted average.

Future Directions

In real-world Brain-Computer Interfaces (BCIs), Fuzzy Logic is often combined with Neural Networks (Neuro-Fuzzy Systems like ANFIS) to automatically tune the membership functions based on user-specific training data. This handles inter-subject variability, as one person's "High Alpha" might look different from another's.