load a
s=a(:,1);%x; %获取要处理的信号,x是在上面.mat里的一个参数?
subplot(2,2,1);plot(s);
%整个信号的长度?
N = numel(s);
%小波分解;?
maxlev=5; %分解6尺度7层
wavename = 'db5'; %小波函数名称(需根据信号定)
[C,L] = wavedec(s,maxlev,wavename);
%提取分解后逼近系数和细节系数
A7=appcoef(C,L,wavename,5);
D1=detcoef(C,L,1);
D2=detcoef(C,L,2);
D3=detcoef(C,L,3);
D4=detcoef(C,L,4);
D5=detcoef(C,L,5);
D1= zeros(1,length(D1))'; %去掉高频噪声
D2= zeros(1,length(D2))';
C2 = [A7;D5';D4';D3';D2';D1']; %新的系数
y = (waverec(C2,L,wavename))'; %重构去基线后信号
figure
subplot(2,2,1);plot(s);
subplot(2,2,2);plot(y)
首先对比之前的数据和分析之后的数据,看看数据变化和数据量是否多了还是少了