I have an ECG signal, and want to sparsify it using wavelet (DWT) in Matlab. In some paper they use Daubechies wavelet (DB4) with 8-tap filters. but i don't know how to extract the wavelet coefficients and plot a figure like this: enter image description here


  • 3
    $\begingroup$ Welcome to SE.DSP. Why do you want to sparsify an ECG? How would you measure that? Why do you want to use a DWT? Those plot are probably produce with Matlab, concatenating coefficients for low to high pass. $\endgroup$ Aug 20 '17 at 19:42
  • $\begingroup$ thank you very much. I'm working on a compressive sensing project, and need to find a sparsifying base for the ECG signal. i used the DCT but the result wasn't so satisfactory. In fact there is some Dictionary learning method but need some straightforward methods for this problem. $\endgroup$
    – Salman
    Aug 20 '17 at 20:52
  • 2
    $\begingroup$ "I need to" <-- is not a reason. Can you give us a technological or mathematical motivation for the sparsification? What you need to do depends on why you do it. $\endgroup$ Aug 20 '17 at 21:09
  • $\begingroup$ dear Marcus Müller, tnx for your comment. As I told, i'm working on a compressive sensing project that aim to compress the ECG signals. based on many papers the ECG signals is sparse in some basis like DCT and DWT. I want to know how it is possible to use Wavelet to sparsifying the ECG signals. This is all i want and said. tnx again $\endgroup$
    – Salman
    Aug 20 '17 at 21:33

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.

synthetic ECG wavelet decomposition

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.