📄 program_17_05_special.m
字号:
%读入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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -