I am working on training the output of the wavelet transform of a signal using a neural network in MATLAB. So I decided to use 3 layer db4 wave filter for its wavelet transform. I have used an array of 240 elements and after wavelet transform, I get an array l

l = [36;36;65;123;240]

Now, since I have to train my neural network, I have to resample the wavelet transforms of length 36, 36, 65, 123 to an array of 240 elements.

So what I did was, I did wavelet transform of the signal. I resampled each wavelet transform to 240 points, and then resampled the wavelet to 36, 36, 65, 123 points respectively. I got an error of 20.2668. What can be done to reduce error?

I used the following command to resample using MATLAB:

[c1, l] = wavedec(signal, 3, 'db4');

c1a = c1(1:l(1));
c1a = resample(c1a, length(signal), length(c1a));

c1b = c1(1+l(1):l(1)+l(2));
c1b = resample(c1b, length(signal), length(c1b));

c1c = c1(1+l(1)+l(2):l(1)+l(2)+l(3));
c1c = resample(c1c, length(signal), length(c1c));

c1d = c1(1+l(1)+l(2)+l(3):l(1)+l(2)+l(3)+l(4));
c1d = resample(c1d, length(signal), length(c1d));

c2a = resample(c1a, l(1), length(c1a));
c2b = resample(c1b, l(2), length(c1b));
c2c = resample(c1c, l(3), length(c1c));
c2d = resample(c1d, l(4), length(c1d));

X = waverec([c2a; c2b; c2c; c2d], l, 'db4');
err = norm(X-signal)

Now, the error err is reported as

err = 20.26688

What can I do to reduce this error? Please help :)

  • $\begingroup$ Resample has a 4th and 5th argument that can be used to improve accuracy at the expense of computation time. $\endgroup$ – John Nov 11 '14 at 2:14
  • $\begingroup$ Could you give an example for the same? $\endgroup$ – Abhinav Aggarwal Nov 12 '14 at 3:13

Your Answer

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

Browse other questions tagged or ask your own question.