3 %>@brief Wavelet De-noising
5 %> This
function uses MATLAB Wavelet toolbox swt() and wthresh() functions to de-noise the rows of X.
7 %> [1] M. Misiti, Y. Misiti, G. Oppenheim, and J.-M. Poggi, Wavelet Toolbox User’s Guide R2012b. Mathworks, 2012.
10 %> @param no_levels Number of times the signal will be decimated
11 %> @param thresholds Vector of thresholds, one value for each level. Thresholds are best determined by using the SWT denoising 1-D GUI tool from the Wavelet toolbox
12 %> @param waveletname examples: 'haar', 'db2', 'db3' (see Wavelet toolbox)
14 function X =
wden(X, no_levels, thresholds, waveletname)
18 % Number of points of new signal needs to be determined the following way
19 % 1) Think about the number of levels: l
20 % 2) calculate ceil(nf/2^l)*2^l
22 % Example: for nf = 1336 and l = 6, this will give 1344
23 nfnew = ceil(nf/2^no_levels)*2^no_levels;
24 no_extend = ceil((nfnew-nf)/2);
28 Xext = wextend(1, 'sym', X(i, :), no_extend, 'b');
29 Xext = Xext(:, 1:nfnew); % In case nf was odd, Xext will have one column more
32 % SWC contains the decompositions in rows: finest first, ..., then approximation
34 SWC = swt(Xext, no_levels, waveletname);
37 SWC(j, :) = wthresh(SWC(j, :), 'h', thresholds(no_levels+1-j));
40 Xafter = iswt(SWC, waveletname);
42 X(i, :) = Xafter(no_extend+1:no_extend+nf);
function progress2_change(in prgrss, in title, in perc, in i, in n)
function progress2_open(in title, in perc, in i, in n)
function wden(in X, in no_levels, in thresholds, in waveletname)
function progress2_close(in prgrss)