• 大小: 6KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-13
  • 语言: Matlab
  • 标签: 小波包  

资源简介

基于数字信号的小波包的分解与重构代码,适合初学者学习

资源截图

代码片段和文件信息

clear;
x=wavread(‘E:\ta.wav‘);
%N=length(x);
N=1024;
x=x(1:N);
x=x‘;
[ldhd]=wfilters(‘db4‘‘d‘);
%%%%%%%%%%%%%%% di ji fen jie %%%%%%%%%%%%%%%%%%%
ld1=[ldzeros(1N-length(ld))];
hd1=[hdzeros(1N-length(hd))];
t10=ifft(fft(x).*fft(ld1));
t11=ifft(fft(x).*fft(hd1));
t10=dyaddown(t10);
t11=dyaddown(t11);
%%%%%%%%%%%%%%%%%%% di er ji fen jie %%%%%%%%%%%%%%%%%%%%%
ld2=[ldzeros(1N/2-length(ld))];
hd2=[hdzeros(1N/2-length(hd))];
t20=ifft(fft(t10).*fft(ld2));
t21=ifft(fft(t10).*fft(hd2));
t22=ifft(fft(t11).*fft(ld2));
t23=ifft(fft(t11).*fft(hd2));
t20=dyaddown(t20);
t21=dyaddown(t21);
t22=dyaddown(t22);
t23=dyaddown(t23);
%%%%%%%%%%%%%%%%%%%% di san ji fen jie %%%%%%%%%%%%%%
ld3=[ldzeros(1N/4-length(ld))];
hd3=[hdzeros(1N/4-length(hd))];
t30=ifft(fft(t20).*fft(ld3));
t31=ifft(fft(t20).*fft(hd3));
t32=ifft(fft(t21).*fft(ld3));
t33=ifft(fft(t21).*fft(hd3));
t34=ifft(fft(t22).*fft(ld3));
t35=ifft(fft(t22).*fft(hd3));
t36=ifft(fft(t23).*fft(ld3));
t37=ifft(fft(t23).*fft(hd3));
t30=dyaddown(t30);
t31=dyaddown(t31);
t32=dyaddown(t32);
t33=dyaddown(t33);
t34=dyaddown(t34);
t35=dyaddown(t35);
t36=dyaddown(t36);
t37=dyaddown(t37);
figure(1);
subplot(511)
plot(real(t30))
subplot(512)
plot(real(t31))
subplot(513)
plot(real(t32))
subplot(514)
plot(real(t33))
subplot(515)
plot(real(t34))
%%%%%%%%%%%%%%%%%%%%%%%%% di si ji fen jie %%%%%%%%%%%%%%%%%%%
ld4=[ldzeros(1N/8-length(ld))];
hd4=[hdzeros(1N/8-length(hd))];
t40=ifft(fft(t30).*fft(ld4));
t41=ifft(fft(t30).*fft(hd4));
t42=ifft(fft(t31).*fft(ld4));
t43=ifft(fft(t31).*fft(hd4));
t44=ifft(fft(t32).*fft(ld4));
t45=ifft(fft(t32).*fft(hd4));
t46=ifft(fft(t33).*fft(ld4));
t47=ifft(fft(t33).*fft(hd4));
t48=ifft(fft(t34).*fft(ld4));
t49=ifft(fft(t34).*fft(hd4));
t410=ifft(fft(t35).*fft(ld4));
t411=ifft(fft(t35).*fft(hd4));
t412=ifft(fft(t36).*fft(ld4));
t413=ifft(fft(t36).*fft(hd4));
t414=ifft(fft(t37).*fft(ld4));
t415=ifft(fft(t37).*fft(hd4));
t40=dyaddown(t40);
t41=dyaddown(t41);
t42=dyaddown(t42);
t43=dyaddown(t43);
t44=dyaddown(t44);
t45=dyaddown(t45);
t46=dyaddown(t46);
t47=dyaddown(t47);
t48=dyaddown(t48);
t49=dyaddown(t49);
t410=dyaddown(t410);
t411=dyaddown(t411);
t412=dyaddown(t412);
t413=dyaddown(t413);
t414=dyaddown(t414);
t415=dyaddown(t415);
%%%%%%%%%%%%%%%%%%%%%%%%%%%% di si ji chong  gou %%%%%%%%%%%%%%
t40=dyadup(t40);
t41=dyadup(t41);
t42=dyadup(t42);
t43=dyadup(t43);
t44=dyadup(t44);
t45=dyadup(t45);
t46=dyadup(t46);
t47=dyadup(t47);
t48=dyadup(t48);
t49=dyadup(t49);
t410=dyadup(t410);
t411=dyadup(t411);
t412=dyadup(t412);
t413=dyadup(t413);
t414=dyadup(t414);
t415=dyadup(t415);
t40=t40(1:length(t40)-1);
t41=t41(1:length(t41)-1);
t42=t42(1:length(t42)-1);
t43=t43(1:length(t43)-1);
t44=t44(1:length(t44)-1);
t45=t45(1:length(t45)-1);
t46=t46(1:length(t46)-1);
t47=t47(1:length(t47)-1);

评论

共有 条评论