• 大小: 1KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-12-23
  • 语言: Matlab
  • 标签:

资源简介

小波滤波,可用于心电信号、脉搏波信号的滤波;matlab

资源截图

代码片段和文件信息


%  mallet_wavelet.m
%  此函数用于研究Mallet算法及滤波器设计
%  此函数仅用于消噪
a=pi/8;                  %角度赋初值
b=pi/8;
%低通重构FIR滤波器h0(n)冲激响应赋值
h0=cos(a)*cos(b);
h1=sin(a)*cos(b);
h2=-sin(a)*sin(b);
h3=cos(a)*sin(b);
low_construct=[h0h1h2h3];
L_fre=4;                             %滤波器长度
low_decompose=low_construct(end:-1:1);   %确定h0(-n),低通分解滤波器
for i_high=1:L_fre;                      %确定h1(n)=(-1)^n高通重建滤波器
    if(mod(i_high2)==0);
    coefficient=-1;
    else
    coefficient=1;
    end
    high_construct(1i_high)=low_decompose(1i_high)*coefficient;
end
high_decompose=high_construct(end:-1:1);  %高通分解滤波器h1(-n)
L_signal=1578;   %信号长度
n=1:L_signal;   %信号赋值
f=10;
t=0.001;
a=load([Name‘.txt‘]);
y=a(st:n2:2); 
h1=figure(1);
plot(y);
title(‘原信号‘);
fileName=[Name‘.jpg‘];
saveas(h1fileName‘jpg‘);
check1=sum(high_decompose);         %h0(n)性质校验
check2=sum(low_decompose);
check3=norm(high_decompose);
check4=norm(low_decompose);
l_fre=conv(ylow_decompose);        %卷积
l_fre_down=dyaddown(l_fre);         %抽取得低频细节
h_fre=conv(yhigh_decompose);
h_fre_down=dyaddown(h_fre);         %信号高频细节
h2=figure(2);
subplot(211)
plot(l_fre_down);
title(‘小波分解的低频系数‘);
subplot(212);
plot(h_fre_down);
title(‘小波分解的高频系数‘);
fileName=[Name‘_小波分解高频和低频系数‘‘.jpg‘];  %截取后平滑处理后的图片
saveas(h2fileName‘jpg‘);
l_fre_pull=dyadup(l_fre_down);     %0差值
h_fre_pull=dyadup(h_fre_down);
l_fre_denoise=conv(low_constructl_fre_pull);
h_fre_denoise=conv(high_constructh_fre_pull);
l_fre_keep=wkeep(l_fre_denoiseL_signal);   %取结果的中心部分消除卷积影响
h_fre_keep=wkeep(h_fre_denoiseL_signal);
sig_denoise=l_fre_keep+h_fre_keep;          %信号重构
compare=sig_denoise-y;                      %与原信号比较
h3=figure(3);
subplot(311)
plot(y);                                   
ylabel(‘y‘);             %原信号
subplot(312);
plot(sig_denoise);                          
ylabel(‘sig\_denoise‘);  %重构信号
subplot(313);
plot(compare);
ylabel(‘compare‘);       %原信号与消噪后信号的比较
fileName=[Name‘__对比‘‘.jpg‘];  %截取后平滑处理后的图片
saveas(h3fileName‘jpg‘);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2256  2009-03-18 20:17  Untitled2.m

----------- ---------  ---------- -----  ----

                 2256                    1


评论

共有 条评论

相关资源