基于小波区间相关(Interval-Dependent)的信号降噪方法

本文大致演示一下如何使用与区间相关(Interval-Dependent)的阈值对信号进行降噪,包括使用最小阈值对全区间进行降噪,使用最大阈值对全区间进行降噪,手动选择3个阈值对3个区间进行降噪等。

全区间降噪

加载一个居民用电量信号nelec

load nelec.mat
sig = nelec;

选取sym4小波,分解层数为5,阈值类型设置为"s"(软阈值)

wname = 'sym4';
level = 5;
sorh  = 's';

使用wdencmp函数对信号进行降噪,阈值设置为4.5(GUI工具提供的最小值)

thr = 4.5;
[sigden_1,~,~,perf0,perfl2] = wdencmp('gbl',sig,wname,level,thr,sorh,1);
res = sig-sigden_1;
subplot(3,1,1)
plot(sig,'r') 
axis tight
title('Original Signal')
subplot(3,1,2)
plot(sigden_1,'b') 
axis tight
title('Denoised Signal')
subplot(3,1,3)
plot(res,'k') 
axis tight
title('Residual')

根据上图可知,降噪的结果并不好,信号降噪在开始和结束时较为有效,但在 100 和 1100 之间,噪声没有被去除。perf0 值给出了系数置0百分比,而 perfl2 值给出了保留能量的百分比。

使用wdencmp函数对信号进行降噪,阈值设置为19.5(GUI工具提供的最大值)

thr = 19.5;
[sigden_2,cxd,lxd,perf0,perfl2] = wdencmp('gbl',sig,wname,level,thr,sorh,1);
res = sig-sigden_2;
subplot(3,1,1)
plot(sig,'r')
axis tight
title('Original Signal')
subplot(3,1,2)
plot(sigden_2,'b')
axis tight
title('Denoised Signal')
subplot(3,1,3)
plot(res,'k')
axis tight
title('Residual')

降噪后的信号非常平滑,但是如果查看位置 1100 之后的残差,可以看到底层噪声的方差不是恒定的,信号的某些分量可能保留在残差中,例如位置 1300 附近以及位置 1900 和 2000 之间。

使用区间相关阈值 (IDT) 降噪

首先对信号进行离散小波分解

[coefs,longs] = wavedec(sig,level,wname);

对信号 nelec 进行区间相关阈值处理,并将区间数设置为 3,区间及相应的阈值具体设置如下

  • I1 = [1 94] with a threshold thr1 = 5.9
  • I2 = [94 1110] with a threshold thr2 = 19.5
  • I3 = [1110 2000] with a threshold thr3 = 4.5

定义区间相关阈值

denPAR = {[1 94 5.9 ; 94 1110 19.5 ; 1110 2000 4.5]};
thrParams = cell(1,level);
thrParams(:) = denPAR;

看一下每级小波系数的区间相关阈值

对于每级k,变量 thrParams{k}包含降噪过程的间隔和相应的阈值,逐级和逐个区间对小波系数进行阈值化,即使用函数wthresh将水平线之间的小波系数值替换为零从而进行阈值化,绘制信号经阈值处理后的小波系数

重构降噪信号

sigden = waverec(coefs,longs,wname);
res = sig - sigden;

绘制原始信号、降噪信号和残差信号

figure
subplot(3,1,1)
plot(sig,'r')
hold on 
plot(sigden,'b')
axis tight
title('Original and Denoised Signals')
subplot(3,1,2)
plot(sigden,'b')
axis tight
title('Denoised Signal')
subplot(3,1,3)
plot(res,'k')
axis tight
title('Residual')

比较信号的三个降噪版本

figure
plot(sigden_1,'g')
hold on 
plot(sigden_2,'r')
plot(sigden,'k')
axis tight
hold off
legend('Denoised Min','Denoised Max','Denoised IDT','Location','North')

放大一下信号的末端

当使用最大阈值时,降噪信号被过度平滑,信息丢失,而使用基于区间相关阈值方法给出了较好的结果。

区间相关阈值的自动计算

使用 utthrset_cmd 函数自动计算每个区间的阈值,然后,通过阈值进行信号降噪

[coefs,longs] = wavedec(sig,level,wname);
siz = size(coefs);
thrParams = utthrset_cmd(coefs,longs);

sigden = waverec(coefs,longs,wname);
figure
subplot(2,1,1)
plot(sig,'r')
axis tight
hold on
plot(sigden,'k')
title('Original and Denoised Signals')
subplot(2,1,2)
plot(sigden,'k')
axis tight
hold off
title('Denoised Signal')

基于小波区间相关(Interval-Dependent)的信号降噪方法 - 哥廷根数学学派的文章 - 知乎 https://zhuanlan.zhihu.com/p/558132966

代码如下

https://mianbaoduo.com/o/bread/Yp6ZlZlt

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章