sparsifying an ECG signal using wavelet
As illustrated by the simplified figure and the Matlab code below, such a graph can be obtained with a standard discrete wavelet decomposition, possibly with a periodic extension to preserve the size, over 3 to 5 levels of decomposition. Wavelet coefficients are simply concatenated in the standard low-frequency  /high-frequency  fashion, with scaling coefficients first, and followed by the wavelet coefficients.



load ecgData;
data = x(1:256,1);
waveletName = 'db4';
waveletLevel = 4;
dwtmode('ppd');
[C,L] = wavedec(data,waveletLevel,waveletName);
subplot(2,1,1);  plot(data);axis tight
subplot(2,1,2);  stem(C);axis tight