MATLAB Answers

DWT vs. MODWT vs. EMD

조회 수: 27(최근 30일)
Marc Huber
Marc Huber 22 Apr 2016
Hello,
I have decomposed fmri time series. At my first try, I used wavedec and wrcoef with db10 wavelet, level 10. Then I did it with modwt and modwtmra. To compare the results, I summed up the decompositions to receive a reconstructed original signal. After I subtracted and summed up the reconstructed from the original signal in absolute value.
So, why is MODWT in this case better (smaller value of summed up differences) than DWT? Which wavelet I should use for DWT or for MODWT? Which wavelet use Matlab for MODWT if I do not choose one explicit. How MODWT choose the number of levels? I always receive 11 decompositions with MODWT of a time signal.
I also did a decomposition with EMD. The result of EMD seems more exactly (means less variance of the summed up decompositions regarding to the original signal).
Is there any way to get a better solution with wavelets as with EMD?
Thanks

  댓글 수: 1

shivi varshney
shivi varshney 29 Apr 2019
hello sir , i am also using modwt and modwtmra in my project work. can you please share your modwt decomposition code with my email. address varshneyshivi31@gmail.com
. it will very helpful to me.
thankyou somuch

로그인 to comment.

답변 수 (2)

Wayne King
Wayne King 5 May 2016
Marc, MODWT uses the 'sym4' wavelet by default if one is not specified. That is given in the help and documentation. Also, the default level depends on the signal length. Basically, it goes as far down as it can. If you increase or decrease your signal length, you will see the number of levels change.
For example,
load wecg;
wt = modwt(wecg);
size(wt)
ts = wecg(1:512);
wt1 = modwt(ts);
size(wt1)
If you look at the details in wt(end,:), you will see that it is a constant (to within numerical precision) equal to the mean of the signal.
plot(wt(end,:))
ylim([mean(wecg)-0.1 mean(wecg)+0.1])
mean(wecg)
MODWT will exactly preserve the energy in the signal at the decomposition. It is a redundant wavelet transform, but it still acts like an orthogonal transform. If you then obtain the mulitresolution analysis using MODWTMRA and sum the components, you will reconstruct the signal exactly.
See the examples in the reference pages for demonstrations of this.
I'm not sure what "The result of EMD seems more exactly (means less variance of the summed up decompositions regarding to the original signal)." this means, summing up the modwtmra will give you the signal back exactly. The maximum absolute error for any given sample will be something like 10^(-12)
load wecg; wt = modwt(wecg); mra = modwtmra(wt); ts = sum(mra); norm(abs(wecg'-ts),Inf)
Or using IMODWT
wt = modwt(wecg);
xrec = imodwt(wt);
norm(abs(wecg'-xrec),Inf)
That is perfect reconstruction. So can you be more specific or include code samples of what you mean by better?

  댓글 수: 1

Marc Huber
Marc Huber 6 May 2016
Hi Wayne,
'That is given in the help and documentation'. Yes, sorry for this question. Shame on me.
I have an 4-D array named 'tc.mat' with (prepared with ica and other methods) fmri data. My goal is to compare a wavelet-decomposition with an EMD-decomposition. So the first step is to choose the best wavelet-method for decomposing fmri time series.
So, dwt or modwt, what is better?
DWT: load('tc.mat');
s=size(tc);
z=zeros(24,11);
for k=1:s(1,1)
for l=1:s(1,2)
for j=1:s(1,4)
signal=squeeze(tc(k,l,:,j));
[C,L]=wavedec(signal,10,'db10');
cA10 = wrcoef('a',C,L,'db10',10);
z(j,11,1:s(1,3))=cA10;
for i=1:10
z(j,i,1:s(1,3))=wrcoef('d',C,L,'db10',i);
end
end
imfs{k,l}=z;
end
end
But how can I be sure, that db10 is the best mother wavelet?
load('tc.mat');
sImf=size(imfs);
diffDWT=0;
for k=1:sImf(1,1)
for l=1:sImf(1,2)
subImfs=imfs{k,l};
for j=1:24
signal=squeeze(tc(k,l,:,j));
xrec=squeeze(sum(subImfs(j,:,:)));
diffDWT=diffEMD+sum(abs(signal-xrec));
end
end
end
As you can see, diffDWT is the sum of the sum of all errors in the signals. Therefore, the smaller the diffDWT value the better the reconstruction. So I tried a lot of different mother wavelets and found out (guess/think) that db10 is best because diffDWT returns the smallest value for db10: diffDWT=1.015136367861222e-04
Question 1: Is there a better method to find the 'best' mother wavelet? How would you choose the mother wavelet?
Modwt:
As you can see, the value of diffWave=1.2680-e05 is smaller than the value of diffDWT and therefore modwt is better than DWT.
Question 2: If I choose other mother wavelets at modwt I receive a more worse result (higher value of diffWave) than if I use the default wavelet (sym4). Is sym4 the best mother wavelet for modwt? DWT and MODWT aren't so much different. Why at DWT db10 is best and at MODWT sym4? This make no sense for me.
So far so good.
Now let's have a look at EMD. EMD decompose the Signal also until 'the end' (till the trend) like MODWT do. Most I receive 11 IMF's for one Signal. In some cases I receive 12, 13 or 14 IMF's. I did the same as with modwt. I summed up the IMF's of one Signal, subtracted from the original, summed up this error and summed up the error value of all signals. So I receive diffEMD=2.529110828857835e-09. This value is smaller than diffWave=1.2680e-05 and therefore the reconstruction is more exact.
Question 3: It is great that MODWT yields always 11 decompositions (but don't know why MODWT it do and EMD not). The problem is, that EMD yields different numbers of IMF's (11-14). So I remove IMF's > 11, because they are not of great interest. Can I compare the 11 modes of MODWT with the 11 IMF's? Should be a similar result, isn't it? I am not sure which result/decomposition is better. If I do not remove IMF's > 11 EMD seems to be better, because the reconstruction is more exact. And I think if the error of reconstruction is smaller, also the individual modes are more exact.
But I am not sure If I remove IMF's >11. If some decompositions yields 14 IMF's, so some information could embedded in the 14th IMF which I had removed before. So which result is better? An more exact decomposition with (perhaps) a loss of information because of removeing IMF's > 11 or a less exact decomposition but (perhaps) without loss of information?
What do you think? How to compare?
Thank you very very much.

로그인 to comment.


Wayne King
Wayne King 7 May 2016
EMD is an adaptive technique. This has strengths but also weaknesses so whether you might use EMD vs MODWT depends a lot on your ultimate goal. The MODWT lends itself to robust statistical analysis because there is a lot known about the statistical properties of the wavelet coefficients, see for example MODWTVAR, MODWTXCORR for example. We are able to put confidence intervals around variance (power) estimates for the MODWT subbands precisely because we have good knowledge of the statistical behavior of the wavelet transform. That cannot be said for EMD. EMD is data adaptive.
I don't know which implementation of EMD, you are using, but there are at least four stopping criteria I know of for EMD algorithms. Depending on which you are using you may get a slightly different point at which the "sifting process" (as it is called) stops. Basically, it goes until it cannot generate any more (new) intrinsic mode functions -- how it determines that again depends on the algorithm you are using.
How far, the MODWT goes down is based on the sample size (and again with any wavelet transform, you don't have to go all the way). Bascially the MODWT will go down until what is left as the scaling coefficients is just equal to the mean of the signal. I'll demonstrate here:
load wecg;
wt = modwt(wecg);
Now look at
app = wt(end,:);
The above is essentially just a constant vector equal to the mean of the signal. Taking the wavelet transform any further is pointless, the wavelet coefficients will be nothing but zeros and the scaling coefficients won't change.
I think the differences in reconstruction you show above don't mean EMD is better than MODWT. These are very small differences. For example for my version of EMD,
load wecg;
imf = emd(wecg);
wt = modwt(wecg);
xrec = imodwt(wt);
imfrec = sum(imf);
max(abs(wecg'-imfrec))
max(abs(wecg'-xrec))
4.4409e-16
ans =
2.3253e-12
So in the case of the EMD, the worst mismatch between the reconstruction and the signal sample is 10^(-16) for the MODWT (10^(-12)). Are we really worried about that difference? They both reconstruct the signal perfectly.
As far as the wavelet to choose, that depends on the goal of your analysis. What is your ultimate reason for doing a multiresolution analysis of these signals?

  댓글 수: 1

Marc Huber
Marc Huber 8 May 2016
Thank you for answer Wayne. Why do you always talk about perfect reconstruction? For me, perfect means error equals zero, or how is perfect at wavelets/filter banks defined? How small have the error to be that we can talk about perfect reconstruction? Do you think one can disregard the error if it is very small?
My goal is to find resting state networks. So because of dynamic functional connectivity next step is to split each decomposition into small parts, create a correlation matrix from the first, second, third, and so on, splitted part of the 1,..,11 decomposition of all 100 probands, and then do a k-means clustering to find cluster centroids.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by