Written in Delphi (Pascal for Windows)
Progress has been stop-start. After seeing the amazing (and very similar) work by Dr Kenneth Gilpin, I tried his technique of transformed sine-waves as the basis for the ECG trace. Despite a lot of work, I found it difficult to get the "organic" feel I was aiming for.
So I started playing around with gaussian curves, on the basis that these better simulate what happens to a signal as it passes through tissues. Right away I preferred the look. I now generate the entire ECG waveform and all variations by stacking and scaling gaussian curves.
The gaussian function is not particularly computationally expensive, however in a simulator every micro-second counts so it is run once when the program is started and the values are stored as a high-res look-up array. There are NO other functions used in the creation of the ECG waveform.
If you are interested you can download the current "work-in-progress" version here:
The model randomises itself every 4 seconds, if you watch for long enough you will see the entire range of waveforms it can generate. A single generated source waveform is displayed, this is used to produce the ecg trace. It is interesting to see how the waveform of tachyarrhythmias relates to the underlying source single waveform.
Atrial and ventricular fibrillation. ST elevation in its various forms.