📄 6-9.m
字号:
%例程6-9 方波信号的离散小波变换
% e.g.6-9.m for example6-9;
%test the function of wavedec.
clear all;
t=0:.01*pi:10*pi;
x=square(t,80);
X=x+randn(size(x))/10;
subplot(5,2,1:2); plot(t,X);
xlabel('Time t');
axis([0 11*pi -2 2]);
ylabel('Amplitude X');
title('Original signal ')
% Perform decomposition at level 3 of X using sym8.
wname='sym8';
[c,l] = wavedec(X,3,wname);
%At level 1
ca1=appcoef(c,l,wname,1); %1-D approximation coefficients
cd1=detcoef(c,l,1); %1-D detail coefficients
subplot(523); plot(ca1); title('Approx. coef. at level 1');
subplot(524); plot(cd1); title('Detail coef. at level 1');
%At level 2
ca2=appcoef(c,l,wname,2);
cd2=detcoef(c,l,2);
subplot(525); plot(ca2); title('Approx. coef. at level 2');
subplot(526); plot(cd2); title('Detail coef. at level 2');
%At level 3
ca3=appcoef(c,l,wname,3);
cd3=detcoef(c,l,3);
subplot(527); plot(ca1); title('Approx. coef. at level 3');
subplot(528); plot(cd1); title('Detail coef. at level 3');
% Reconstruct approximation at level 3 from the wavelet decomposition structure [c,l].
ra3 = wrcoef('a',c,l,'sym8',3);
subplot(5,2,9:10); plot(ra3);
title('Reconstruct signal form approximation at level 5:ra3');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -