进行DWT的函数为: [C,L]=wavedec(x,N,'wname')
进行IDWT的函数为:x=waverec(C,L,'wname')
其中 wname为小波名;x为时域序列信号;N为小波变换的级数。
利用部分小波系数重建信号:x=wrcoef('type',C,L,'wname',N)
其中 type='a'为 由第N级近似分量重建信号
type='d'为 由第N级细节分量重建信号
doppler = wnoise(4,10);
N = 5;
wname = 'db4';
[C,L] = wavedec(doppler,N,wname);
A0 = waverec(C,L,wname);
A5 = wrcoef('a',C,L,wname,5);
A4 = wrcoef('a',C,L,wname,4);
A3 = wrcoef('a',C,L,wname,3);
A2 = wrcoef('a',C,L,wname,2);
A1 = wrcoef('a',C,L,wname,1);
D5 = wrcoef('d',C,L,wname,5);
D4 = wrcoef('d',C,L,wname,4);
D3 = wrcoef('d',C,L,wname,3);
D2 = wrcoef('d',C,L,wname,2);
D1 = wrcoef('d',C,L,wname,1);
figure(1);
plot(doppler,'k','linewidth',2);
hold on;
plot(A0,'-.r','linewidth',2);
hold on;
plot(A5,'--b','linewidth',2);
legend('original doppler signal','IDWT signal----A0','level 5 approximation signal----A5');
axis([0 400 -1 1]);
set(gcf,'unit','centimeters','position',[10 10 30 10]);
figure(2);
subplot(3,2,1);
plot(doppler,'k','linewidth',2);
title('doppler signal');
axis([0 400 -1 1]);
subplot(3,2,2);
plot(D5,'k','linewidth',2);
title('D5 detail of db4');
axis([0 400 -1 1]);
subplot(3,2,3);
plot(D4,'k','linewidth',2);
title('D4 detail of db4');
axis([0 400 -1 1]);
subplot(3,2,4);
plot(D3,'k','linewidth',2);
title('D3 detail of db4');
axis([0 400 -1 1]);
subplot(3,2,5);
plot(D2,'k','linewidth',2);
title('D2 detail of db4');
axis([0 400 -1 1]);
subplot(3,2,6);
plot(D1,'k','linewidth',2);
title('D1 detail of db4');
axis([0 400 -1 1]);
figure(3);
subplot(3,2,1);
plot(doppler,'r','linewidth',2);
title('doppler signal');
axis([0 400 -1 1]);
subplot(3,2,2);
plot(A5,'r','linewidth',2);
title('A5 approximation');
axis([0 400 -1 1]);
subplot(3,2,3);
plot(A4,'r','linewidth',2);
title('A4 approximation');
axis([0 400 -1 1]);
subplot(3,2,4);
plot(A3,'r','linewidth',2);
title('A3 approximation');
axis([0 400 -1 1]);
subplot(3,2,5);
plot(A2,'r','linewidth',2);
title('A2 approximation');
axis([0 400 -1 1]);
subplot(3,2,6);
plot(A1,'r','linewidth',2);
title('A1 approximation');
axis([0 400 -1 1]);
网友评论