laszukdawid / PyEMD

Python implementation of Empirical Mode Decompoisition (EMD) method
https://pyemd.readthedocs.io/
Apache License 2.0
867 stars 224 forks source link

Compare with matlab's emd algorithm #101

Closed xixia123 closed 3 years ago

xixia123 commented 3 years ago

For the same set of data, the emd algorithm that comes with matlab 2020b is inconsistent with the eigenmode function obtained by using the python package emd-signal to calculate, that is, the IMFs data is inconsistent

laszukdawid commented 3 years ago

Hey,

Thanks for letting me know!

Unfortunately, I can't check this as I don't have Matlab access; I'm not at a university anymore and in general it's too expensive. These differences, however, are also somehow expected (I think I've already mentioned them in few issues before or in docs). In general, EMD is too loosely defined. Due to a large number of sifting iterations, tiny differences in algorithm implementations can result in significant differences in results. For example, calculating cubic spline requires inverting a large matrix which isn't trivial and there can be some rounding. Matlab has a team of developers who are constantly improving their algorithms so they could've changed since my last test (2012b). PyEMD is using some dependencies could have their own problems. There could be other reasons.

All in all, I'm sorry, but I can't do much about it. Any help in finding out whether that is an issue and how to fix it is highly appreciated.

xixia123 commented 3 years ago

Thanks a lot for your reply. I compared the emd algorithm in matlab and python and found that there is a difference in the envelope of the calculated signal. When I look at the PyEMD.EMD._find_extrema_simple(t,s)part of the code, I don't quite understand what a variable indzerin the function means and what does it do?

xixia123 commented 3 years ago

I had solved my problem. I implemented the emd algorithm in matlab using python and it works well. Anyway, thanks for your help.