What is modelled. The body picks up mains through stray capacitance, so both electrodes sit at a common-mode voltage Vcm relative to the amplifier. Each electrode has a skin-contact impedance modelled as R in parallel with 22 nF, in series with the amplifier input impedance Zin (Rin in parallel with 10 pF). The input node voltage is a divider, Vk = Vcm Zin / (Zin + Zk). If the two electrodes differ (R2 = R1 + ΔR) the two nodes differ too: Vd = V1 - V2, and the amplifier cannot tell this from the heartbeat. At low frequency this gives an effective rejection Vc/Vd = (2Rin + R1 + R2) / (2ΔR) ≈ Rin/ΔR, which is why a high input resistance and well-matched, low-impedance electrodes matter more than a very large amplifier CMRR.
Amplifier CMRR. A real differential amplifier also converts a little common-mode into differential: the residual is Vres = Vd + Vc/CMRR, added as complex phasors (the CMRR term is taken in phase with the common-mode node voltage). The result is referred to the input and drawn as a 50/60 Hz sine on top of the signal. Driven right leg (DRL) is modelled as an inverting feedback that lowers the common-mode voltage on the body by a factor 1 + 30 = 31 (30 dB loop gain, a typical order of magnitude); real DRL stages have limits and safety resistors.
Signals. The ECG is a sum of five Gaussians (P, Q, R, S, T) repeating at 72 beats per minute with a 1 mV R wave; the EEG is a 10 Hz alpha rhythm of 50 µV with a slow envelope and two other rhythms. Noise is a deterministic Gaussian sequence (about 15 µV ECG, 6 µV EEG). These are shapes chosen for illustration, not recordings.
Checks. (1) The phasor result is compared with a time-domain RK4 integration of the two electrode networks with a lock-in at the mains frequency. (2) The divider formula is compared with a complex nodal (admittance) solution. (3) The low-frequency CMRR from the phasor code (capacitors removed) against the closed form above. (4) ECG mode: the heart rate recovered by R-peak detection from the generated samples; EEG mode: the alpha frequency from zero crossings.
Not modelled. Real electrode half-cell potentials and their drift, motion artefact, patient leakage current limits, input protection, the amplifier's own noise, filtering and sampling (aliasing is a separate topic), 3-electrode lead-off detection, and the fact that real mains pickup depends on cable geometry and distance. Component values are typical orders of magnitude quoted from memory (electrode contact impedance tens of kilo-ohms, input resistance 10 megaohm or more, CMRR 80 to 110 dB) and should be spot-checked. This page is a teaching model of signal acquisition. It is not a medical device, gives no diagnosis or treatment advice and must not be used to judge any real recording.
The monitor, amplifier box, circuit board, electrodes, desk and power strip were modelled and Cycles-baked in Blender; the circuit solution, time-domain check and the live screen texture run in Three.js r160.