2

我正在使用 MATLAB 中的神经网络训练信号的小波变换的输出。所以我决定使用3db4滤波器进行小波变换。我使用了一个240元素数组,经过小波变换,我得到了一个数组l

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

现在,由于我必须训练我的神经网络,我必须将长度的小波变换重新采样36, 36, 65, 123为 240 个元素的数组。

所以我所做的是,我对信号进行了小波变换。我将每个小波变换重新采样为240点,然后将小波36, 36, 65, 123分别重新采样为点。我有一个错误20.2668。可以做些什么来减少错误?

我使用以下命令使用 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)

现在,错误 err 报告为

err = 20.26688

我能做些什么来减少这个错误?请帮忙 :)

重新采样和原始后的小波变换数据图为:显示原始信号和重新采样信号的图像

4

1 回答 1

1

If you want to resample all wavelet coefficients to your signal length, 240, and then use them as features for a classification, as far as I know, that is wrong because wavelet coefficients are like frequency components and you can't assign them to time domain samples.

What I suggest is to reconstruct your signal with different combinations of wavelet coefficients, so you would have a signal in time domain, then you could use it as feature.

I provided an example,

X = sin(rand(1,240)).*sin(5*linspace(0,2*pi,240));
subplot(5,1,1)
plot (X); title ('Original Signal');
[C, L] = wavedec(X, 3, 'db4');
C1 = C; C2 = C; C3 = C; C4 = C;
C1(L(1)+1:end) = 0;
X1 = waverec(C1, L, 'db4');
subplot(5,1,2)
plot(X1);title ('A3');
C2(1:L(1)) = 0;
C2(L(1)+L(2)+1:end) = 0;
X2 = waverec(C2, L, 'db4');
subplot(5,1,3)
plot(X2); title ('D3');
C3(1:L(1)+L(2)) = 0;
C3(L(1)+L(2)+L(3)+1:end) = 0;
X3 = waverec(C3, L, 'db4');
subplot(5,1,4)
plot(X3); title ('D2');
C4(1:L(1)+L(2)+L(3)) = 0;
C4(L(1)+L(2)+L(3)+L(4)+1:end) = 0;
X4 = waverec(C4, L, 'db4');
subplot(5,1,5)
plot(X4); title ('D1');

Gives 4 signals all with length 240 which can be used as features.

enter image description here

于 2014-11-11T07:11:51.860 回答