I have EEG signal data (19 channels) sampled at 128Hz. I am trying to retrieve the coefficients that are mentioned in a research paper included below.

To decompose an EEG signal, a digital FIR filter was used, which is based on a level-3 DAUB4 wavelet. The spectral Domain of the filter ranges between 5 and 45 Hz.

  1. How can I calculate filter coefficients of order 22?

  2. If we denote the input signal on one data channel as $x_k$ and the FIR filter coefficients by $b_0, b_1 \cdots b_{21}$, how can I calculate the filter output $y_k$? $$y_k = \sum_{j=0}^{p-1}b_jx_{k-j} $$Here is the content that I am referring to

Filter Coefficients and PSD

  • 3
    $\begingroup$ Hi there, I'm not sure what you're asking: do you already have the filter coefficients and are asking how to filter the signal? Or are you asking how to retrieve the coefficients that have been used in a paper or something? What data do you have access to? Please edit your question with a little more detail ;) $\endgroup$
    – Jdip
    Sep 13, 2022 at 6:39
  • $\begingroup$ 1) The paper mentions theres's a "graph of the filter coefficients". Those are the coefficients you're looking for. Please add this to your question, as well as the the "PSD estimate". 2) What is the sampling frequency for the EEG in the paper (not talking about your signals) $\endgroup$
    – Jdip
    Sep 14, 2022 at 12:58
  • $\begingroup$ As far as the second part of your question, how to calculate the output: that's what the equation with the Sum does. If you're asking this I'm guessing you have very limited experience with signal processing and implementing a signal processing paper is going to be a challenge... What tools are you using? Matlab? Python? R? $\endgroup$
    – Jdip
    Sep 14, 2022 at 13:06
  • $\begingroup$ @Jdip Yes. I had no experience with signal processing. I am using Python. My doubt is whatever the graph of filter coefficients shown in the paper, can I use them for any signal data? or do I have to calculate them? I am asking this doubt because one of my senior told me that I had to calculate these coefficients as they change with data. In the paper they didn't mentioned the sampling frequency of the data they have used. But 128 Hz was the sampling frequency of my data. $\endgroup$ Oct 4, 2022 at 10:38
  • $\begingroup$ Actually, they do: 240Hz (see label for Figure 1) $\endgroup$
    – Jdip
    Oct 4, 2022 at 15:08

1 Answer 1


I am faster in Matlab, the following should be readable and easy to translate. The figure matches, and coefficients follow:

%%% Set a long-enough 'dummy' zero signal
data = zeros(256,1);
%%% Compute the corresponding 'dummy' zero wavelet decomposition
%%% on 3 levels. Warning, Daub4 (basic filter length) mean db2 (moments)
[c,l] = wavedec(data,3,'db2');
%%% Create a new coefficient structure
cDb = c;
%%% Put a discrete delta in the middle on the 3rd AC band
cDb(floor((l(1)+1+l(1)+l(2))/2)) = 1;
%%% Reconstruct the signal. The non-zero samples give you FIR coefficients
dataDb = waverec(cDb,l,'db2');
%%% Ad-hoc selection of the non-zero samples
% dataDbCoefficient = dataDb(115:136);
% plot(dataDbCoefficient,'x-');grid on;axis tight
%%% Better selection of the non-zero samples
dataDbCoefficientBetter = dataDb(dataDb~=0);
plot(dataDbCoefficientBetter,'x-');grid on;axis tight

22 coefficients for the Daubechies-4 or db2 wavelet at three levels


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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