matlab wden nan,Automatic 1-D de-noising

Examples

% The current extension mode is zero-padding (see dwtmode).

% Set signal to noise ratio and set rand seed.

snr = 3; init = 2055615866;

% Generate original signal and a noisy version adding

% a standard Gaussian white noise.

[xref,x] = wnoise(3,11,snr,init);

% De-noise noisy signal using soft heuristic SURE thresholding

% and scaled noise option, on detail coefficients obtained

% from the decomposition of x, at level 5 by sym8 wavelet.

lev = 5;

xd = wden(x,'heursure','s','one',lev,'sym8');

% Plot signals.

subplot(611), plot(xref), axis([1 2048 -10 10]);

title('Original signal');

subplot(612), plot(x), axis([1 2048 -10 10]);

title(['Noisy signal - Signal to noise ratio = ',...

num2str(fix(snr))]);

subplot(613), plot(xd), axis([1 2048 -10 10]);

title('De-noised signal - heuristic SURE');

% De-noise noisy signal using soft SURE thresholding

xd = wden(x,'heursure','s','one',lev,'sym8');

% Plot signal.

subplot(614), plot(xd), axis([1 2048 -10 10]);

title('De-noised signal - SURE');

% De-noise noisy signal using fixed form threshold with

% a single level estimation of noise standard deviation.

xd = wden(x,'sqtwolog','s','sln',lev,'sym8');

% Plot signal.

subplot(615), plot(xd), axis([1 2048 -10 10]);

title('De-noised signal - Fixed form threshold');

% De-noise noisy signal using minimax threshold with

% a multiple level estimation of noise standard deviation.

xd = wden(x,'minimaxi','s','sln',lev,'sym8');

% Plot signal.

subplot(616), plot(xd), axis([1 2048 -10 10]);

title('De-noised signal - Minimax');

% If many trials are necessary, it is better to perform

% decomposition once and threshold it many times:

% decomposition.

[c,l] = wavedec(x,lev,'sym8');

% threshold the decomposition structure [c,l].

xd = wden(c,l,'minimaxi','s','sln',lev,'sym8');

% Editing some graphical properties,

% the following figure is generated.

9bd775aa4c939c6364ffaa2a7f32bcb4.gif

Denoise a signal consisting of a 2-Hz sine wave with transients

at 0.3 and 0.72 seconds. Use Donoho and Johnstone's universal threshold

with level-dependent estimation of the noise. Obtain denoised versions

using the DWT and MODWT. Compare the results.

N = 1000;

t = linspace(0,1,N);

x = 4*sin(4*pi*t);

x = x - sign(t-.3)-sign(.72 - t);

y = x+0.15*randn(size(t));

xdDWT = wden(y,'sqtwolog','s','mln',3,'db2');

xdMODWT = wden(y,'modwtsqtwolog','s','mln',3,'db2');

subplot(2,1,1)

plot(xdDWT), title('DWT Denoising');

axis tight;

subplot(2,1,2)

plot(xdMODWT), title('MODWT Denoising');

axis tight;

d9a198991dbd955bbbe93a6b81a07c36.png

Denoise a blocky signal using the Haar wavelet with MODWT and

DWT denoising. Compare the L2 and L-infty norms of the difference

between the original signal and the denoised versions.

[x,xn] = wnoise('blocks',10,3);

xdMODWT = wden(xn,'modwtsqtwolog','s','mln',6,'haar');

xd = wden(xn,'sqtwolog','s','mln',6,'haar');

plot(x)

hold on

plot(xd,'r--')

plot(xdMODWT,'k-.')

legend('Original','DWT','MODWT')

hold off

norm(abs(x-xd),2),

norm(abs(x-xd),Inf)

norm(abs(x-xdMODWT),2),

norm(abs(x-xdMODWT),Inf)

3adbe231b0321207b52ed6ae66146684.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值