dwt_example.m
%单尺度一维离散小波变换(dwt函数) %装载一维原始信号 load noissin; s=noissin(1:1000); %画出原始信号的波形 subplot(411);plot(s); %函数subplot的作用是在标定位置上建立坐标系 title('原始信号'); %下面用haar小波函数进行一维离散小波变换 [ca1,cd1]=dwt(s,'haar'); subplot(4,2,3);plot(ca1); axis tight; ylabel('haar(ca1)'); subplot(4,2,4);plot(cd1); axis tight; ylabel('haar(cd1)'); %给定一个小波db2,计算与之相关的分解滤波器 [Lo_D,Hi_D]=wfilters('db2','d'); %用分解滤波器Lo_D,Hi_D计算信号s的离散小波分解系数 [ca2,cd2]=dwt(s,Lo_D,Hi_D); subplot(4,2,5);plot(ca2); axis tight; ylabel('db2(ca2)'); subplot(4,2,6);plot(cd2); axis tight; ylabel('db2(cd2)'); %% %单尺度一维离散小波变换(dwt函数) %装入一维原始信号 load leleccum; s=leleccum(1:3920); ls=length(s); %画出原始信号 subplot(131);plot(s); %函数subplot的作用是在标定位置上建立坐标系 [cA1,cD1]=dwt(s,'db1'); %画出原始信号小波分解的近似分量 subplot(132);plot(cA1); %画出原始信号小波分解的细节分量 subplot(133);plot(cD1); %% %一维连续小波变换(cwt函数) %对MATLAB中所带有的noissin信号进行连续小波变换,尺度a分别为12.12,10.24,15.48,1.2,2,4,6,8,10 %小波函数用db3,求出连续小波变换后的系数 load noissin; %装载信号 s=noissin(1:1000); ls=length(s); %计算信号点的个数ls %对s进行一维连续小波变换,把返回系数存到矩阵w中 w=cwt(s,[12.12,10.24,15.48,1.2,2:2:10],'db3','plot'); xlabel('时间'); ylabel('变换尺度'); title('对应于尺度a=12.12,10.24,15.48,1.2,2,4,6,8,10小波变换系数的绝对值');cwt_example.m
%单尺度一维离散小波变换(dwt函数) %装载一维原始信号 load noissin; s=noissin(1:1000); %画出原始信号的波形 subplot(411);plot(s); %函数subplot的作用是在标定位置上建立坐标系 title('原始信号'); %下面用haar小波函数进行一维离散小波变换 [ca1,cd1]=dwt(s,'haar'); subplot(4,2,3);plot(ca1); axis tight; ylabel('haar(ca1)'); subplot(4,2,4);plot(cd1); axis tight; ylabel('haar(cd1)'); %给定一个小波db2,计算与之相关的分解滤波器 [Lo_D,Hi_D]=wfilters('db2','d'); %用分解滤波器Lo_D,Hi_D计算信号s的离散小波分解系数 [ca2,cd2]=dwt(s,Lo_D,Hi_D); subplot(4,2,5);plot(ca2); axis tight; ylabel('db2(ca2)'); subplot(4,2,6);plot(cd2); axis tight; ylabel('db2(cd2)'); %% %单尺度一维离散小波变换(dwt函数) %装入一维原始信号 load leleccum; s=leleccum(1:3920); ls=length(s); %画出原始信号 subplot(131);plot(s); %函数subplot的作用是在标定位置上建立坐标系 [cA1,cD1]=dwt(s,'db1'); %画出原始信号小波分解的近似分量 subplot(132);plot(cA1); %画出原始信号小波分解的细节分量 subplot(133);plot(cD1); %% %一维连续小波变换(cwt函数) %对MATLAB中所带有的noissin信号进行连续小波变换,尺度a分别为12.12,10.24,15.48,1.2,2,4,6,8,10 %小波函数用db3,求出连续小波变换后的系数 load noissin; %装载信号 s=noissin(1:1000); ls=length(s); %计算信号点的个数ls %对s进行一维连续小波变换,把返回系数存到矩阵w中 w=cwt(s,[12.12,10.24,15.48,1.2,2:2:10],'db3','plot'); xlabel('时间'); ylabel('变换尺度'); title('对应于尺度a=12.12,10.24,15.48,1.2,2,4,6,8,10小波变换系数的绝对值');