本文有很多例子,各位看官自行取用:
%%%% 对一维带噪信号进行处理
clear all;clc ;close all;
load noissin;
figure;
s=noissin(1:1000);
subplot(211);plot(noissin);
title('含噪生原始信号');
[C,L]=wavedec(s,3,'sym2');
a=[1 2 3 ]; %% 尺度向量
p=[97 98 95]; %% 阈值向量
nc=wthcoef('d',C,L,a,p);
sd=waverec(nc,L,'sym2');
subplot(212); plot(sd);title('消噪后的信号')
%%%%%%% 对信号进行不同的阈值处理
clear all;
clc ;
y=linspace(-1,1,100);
thr=0.4;
%%% 计算软硬阈值
ythard=wthresh(y,'h',thr);
ytsoft=wthresh(y,'s',thr);
figure;
subplot(311);plot(y); grid on; title('原始信号');
subplot(312);plot(ythard);grid on; title('硬阈值信号');
subplot(313);plot(ytsoft);grid on; title('软阈值信号');
%
clear all;
close all;
clc;
%%%% 软阈值处理
load leleccum;
indx = 1:1024;
x = leleccum(indx);
%产生含噪信号
init = 2055615866;
randn('seed',init);
nx = x + 18*randn(size