1 小波变换

2 小波基的选择

3 小波去噪原理

二、部分源代码

`clear all;%-----------------------------------X = load ('118e00m_n.mat');X = X.val;%-----------------------------------N = length(X);     %number of samples from original signalz = nextpow2(N);p = 2^z;%update number samples if necessary by padding zeros at the end for a power%of 2:if(p > N)    p = p-N;    X(end + p)=0;    N = length(X);end%-----------------------------------%2^7=128, 2^8=256 2^9=512%-----------------------------------i_max = z;   %last level possible.  i = 0 is the first leveli=1;%-----------------------------------cD_cell = cell(1,1);  %cell unit of 1x1 dimensioncA_cell = cell(1,1);  %cell unit of 1x1 dimension%-----------------------------------%DecompositioncA = X;test=N;while (i < i_max +1)    [cA,cD]=dwt(cA,'coif4','mode','per');   %send current approximation and save cA and cD    cD_cell{i,1}= cD;    cA_cell{i,1}= cA;    test = N/(2^i);    i=i+1;endi=1;while (i < i_max +1)    cD_i = cD_cell{i,1};  %current vector of coefficient at level i    l_d = length(cD_i);    m_i = median(abs(cD_i));    sig_i = m_i/0.6745;   %constant for threshold    T = sig_i*sqrt(2.*log(l_d));    k=1;    while(k < l_d+1)        if( abs(cD_i(k)) < T )            cD_i(k)=0;        end            k=k+1;    end    cD_cell{i,1} = cD_i;    i=i+1;end%-----------------------------------%Reconstructioni=i_max;cA = cA_cell{i,1};while (i > 0)    cA = idwt(cA,cD_cell{i,1},'coif4','mode','per');    i=i-1;endfigure(2)X = X(1:1024);plot(X);grid on;title('Original Signal');xlabel('Number of Samples');ylabel('Amplitude in mV');figure(3)cA = cA(1:1024);plot(cA);grid on;title('Denoised Signal');xlabel('Number of Samples');ylabel('Amplitude in mV');%TODO: Refine algorithm for locating peaks..% find R-peak every first peak[~,locs_R]=findpeaks(X,'minpeakheight',50,'minpeakdistance',250);X_inverted = -X;[~,locs_S]=findpeaks(X_inverted,'minpeakheight',50,'minpeakdistance',250);%--------------------------------------[~,locs_R_D]=findpeaks(cA,'minpeakheight',50,'minpeakdistance',250);cA_inverted = -cA;[~,locs_S_D]=findpeaks(cA_inverted,'minpeakheight',50,'minpeakdistance',250);%for detecting Q, from R-peak position find the minimum all the way back and save%the spoti= length(locs_R);j=1;locs_Q = zeros(length(i));while(j< i+1)a=locs_R(j)-35;if(a<0)    a=1;endtemp = X_inverted(a:locs_R(j));   % size properly [~,index]=findpeaks(temp,'npeaks',1);    b = length(temp)- index;    locs_Q(j)= locs_R(j)-b;    j=j+1;end`

四、matlab版本及参考文献

1 matlab版本

2014a

2 参考文献

[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社，2015.

[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社，2020.

[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社，2018.

[4]徐洁.基于小波分析的脉搏波信号处理[J].电子设计工程. 2013,21(11)

[5]王宏旭,张晨洁,刘勇,郭滨.基于贝叶斯估计的小波脑电信号去噪算法研究[J].长春理工大学学报(自然科学版). 2021,44(02)