program_17_05_special.m

来自「小波变换源代码集 这是葛哲学编著《小波分析理论与MATLAB R2007实现》」· M 代码 · 共 56 行

M
56
字号
%读入EEG信号
load eeg.dat;
x=eeg(2,1:512)';
N=length(sig);
%采样频率
fs=312.5;
%小波分解
[c,l] = wavedec(x,5,'db5');
%重构第5层逼近信号
a5 = wrcoef('a',c,l,'db5',5);
%重构第1~5层细节信号
d5 = wrcoef('d',c,l,'db5',5);
d4 = wrcoef('d',c,l,'db5',4);
d3 = wrcoef('d',c,l,'db5',3);
d2 = wrcoef('d',c,l,'db5',2);
d1 = wrcoef('d',c,l,'db5',1);

%显示各层信号
figure(1)
subplot(6,1,1);
plot(a5,'LineWidth',2);
ylabel('a5');
subplot(6,1,2);
plot(d5,'LineWidth',2);
ylabel('d5');
subplot(6,1,3);
plot(d4,'LineWidth',2);
ylabel('d4');
subplot(6,1,4);
plot(d3,'LineWidth',2);
ylabel('d3');
subplot(6,1,5);
plot(d2,'LineWidth',2);
ylabel('d2');
subplot(6,1,6);
plot(d1,'LineWidth',2);
ylabel('d1');
xlabel('时间 t/s');

%时域波形
figure(2);
subplot(2,1,1);
plot((1:N)/fs,x,'LineWidth',2);
%xlabel('时间 t/s');
ylabel('电压 A/uV');
title('原始信号')
%去除噪声,重构信号
subplot(2,1,2);
y=a5+d5+d4;
plot((1:N)/fs,y,'LineWidth',2);
xlabel('时间 t/s');
ylabel('电压 A/uV');
title('去噪声后信号')

 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?