function [ output_args ] = example4_12( input_args )
%EXAMPLE4_12 Summary of this function goes here
% Detailed explanation goes here
clc;
clear;
% 设置信噪比和随机数的初始值
snr = 3; init = 2055615866;
% 生成一个原始信号xref和含高斯白噪声的信号x
[xref,x] = wnoise(3,11,snr,init);
figure(1)
subplot(321)
plot(xref), axis([1 2048 -10 10]);
title('原始信号');
subplot(322)
plot(x), axis([1 2048 -10 10]);
title('含噪信号');
%使用heursure阈值降噪
lev = 5;
xd = wden(x,'heursure','s','one',lev,'sym8');
subplot(323)
plot(xd), axis([1 2048 -10 10]);
title('降噪信号- heuristic阈值');
%使用rigrsure阈值降噪
xd = wden(x,'rigrsure','s','sln',lev,'sym8');
subplot(324)
plot(xd), axis([1 2048 -10 10]);
title('降噪信号 - rigrsure阈值');
%使用sqtwolog阈值降噪
xd = wden(x,'sqtwolog','s','sln',lev,'sym8');
subplot(325)
plot(xd), axis([1 2048 -10 10]);
title('降噪信号 - sqtwologsqtwolog阈值');
%使用minimaxi阈值降噪
xd = wden(x,'minimaxi','s','sln',lev,'sym8');
subplot(326)
plot(xd), axis([1 2048 -10 10]);
title('降噪信号 - minimaxi阈值');
end
function [ output_args ] = example4_13( input_args )
%EXAMPLE4_13 Summary of this function goes here
% Detailed explanation goes here
clc;
clear;
% 设置信噪比和随机数的初始值
snr = 3; init = 2055615866;
% 生成一个原始信号xref和含高斯白噪声的信号x
[xref,x] = wnoise(5,11,7,init);
x=x(1:1000);
xref=xref(1:1000);
n = length(x)
figure(1)
subplot(311)
plot(xref), axis([1 1000 -15 15]);
title('原始信号');
subplot(312)
plot(x), axis([1 1000 -15 15]);
title('含噪信号');
%使用wpdencmp降噪
thr = sqrt(2*log(n*log(n)/log(2)));
xwpd = wpdencmp(x,'s',4,'sym4','sure',thr,1);
subplot(313)
plot(xwpd);
title('小波包降噪信号');
axis([1 1000 -15 15]);
end