version 4.0 (1.53 MB) by
Jerome Gilles

This toolbox proposes the original implementation of Empirical Wavelet Transforms

December 2019: Major update: new version 4.0!

The 1D transform can now handle complex signals (i.e the empirical wavelets are themselves complex since they are not necessarily symmetric in the Fourier domain). The construction of the curvelet filters has been revised, simplified in order to guarantee almost perfect reconstruction. All other 2D transforms have been cleaned and simplified when possible. The plotting functions now add some title to each subfigure. In term of organization, almost all functions now contain the acronym 'EWT' in their name (most of the time as a prefix) to avoid any conflict with external functions.

In this toolbox, we implement the Empirical Wavelet Transform for 1D and 2D signals/images. The principle consists in detecting Fourier supports on which Littlewood-Paley like wavelets are build. In 2D, we revisit different well-known transforms: tensor wavelets, Littlewood-Paley wavelets, ridgelets and curvelets.

The toolbox also provides the scripts used to generate the experiments in the papers:

- J.Gilles, "Empirical wavelet transform" to appear in IEEE Trans. Signal Processing, 2013.

Preprint available at ftp://ftp.math.ucla.edu/pub/camreport/cam13-33.pdf

- J.Gilles, G.Tran, S.Osher "2D Empirical transforms. Wavelets, Ridgelets and Curvelets Revisited", SIAM Journal on Imaging Sciences, Vol.7, No.1, 157--186, 2014.

Preprint available at ftp://ftp.math.ucla.edu/pub/camreport/cam13-35.pdf

- J.Gilles, K.Heal, "A parameterless scale-space approach to find meaningful modes in histograms - Application to image and spectrum segmentation", submitted 2014.

Preprint available at ftp://ftp.math.ucla.edu/pub/camreport/cam14-05.pdf

See the README file and the Documentation folder inside the archive for more instructions

Jerome Gilles (2020). Empirical Wavelet Transforms (https://www.mathworks.com/matlabcentral/fileexchange/42141-empirical-wavelet-transforms), MATLAB Central File Exchange. Retrieved .

Created with
R2016a

Compatible with R2016a and later releases

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

Kiruthika BalakrishnanThank you very much for your excellent work.

I am using a time-series signal for analysis. Then I applied that signal to the EWT1D.m function. Under this function, I have to pass to two variables one is signal, and another is parameters. In the parameter, as per the test_EWT1D function, I gave a sampling frequency rate. but I am getting error like

Dot indexing is not supported for variables of this type.

Error in EWT_Boundaries_Detect (line 72)

if params.log==1

Error in EWT1D (line 53)

boundaries = EWT_Boundaries_Detect(abs(ff(1:round(length(ff)/2))),params);

Kindly please help me.

wahid laib@Jerome Gilles

Thank you very much for the hard work and the amount of information u provide to us, i am currently learning ewt but when i downloaded the toolbox and run Test_EWT1D.m on the example signals like sig1 the results (imfs) are not even close to what is shown in the papers. tried with all the params of the detection method but no hope (using v4.0).

felix fangSorry, Professor Gilles, I didn't make my point clear. According to me,‘;’ or semicolon means a new line in the matlab. So in this f=[f(l-1:-1:1);f;f(end:-1:end-l+1)] matrix, we can see the dimensions dosen't agree. And I try to use ',' or comma to replace the ';', but there are other error messages after this trying. Therefore, I want to know is there anything important I missed. Thanks.

alan huDear Jerome,

End effects have caused problems to all known data analysis methods in the calculation processes and in the interpretation of the results. It need to extend data implicitly or explicitly beyond the existing range. Fourier transform, although applied only to the existing data range,has an implicit assumption that the data of the existing range will repeat piecewise. method of extending data beyond the existing range has been often adopted so as to carry out the spline envelope fitting over and even beyond the existing data range; so, we have to stop the spline at the last extremum.To achieve the goal of extension of data, such as @felix fang mention the mirror extension,have been used. I guess this is the mean by "how can I correct it ", becouse of most of us encountered this problem.Please guide us how to do mirror extension. Thanks

Jerome Gilles@felix fang: to know the details about the filters -> read the papers!

regarding the length of the signal, what do you mean by "how can I correct it"?

felix fangIn the EWT1D.m, I want to know the filtering process.

% We extend the signal by mirroring to deal with the boundaries

l=round(length(f)/2);

f=[f(l-1:-1:1);f;f(end:-1:end-l+1)]; we know the length of f is double of f(l-1:-1:1), and how can I correct it?

felix fangThanks. Maybe I didn't setup all the parameters. I will try again and try to understand the filter functions.

Jerome Gilles@felix First, did you setup all parameters the way they were in the original paper (particularly the boundary detection method)? Second, I made some slight changes in the construction of the filters (the Matlab team reported me that the reconstruction was not "perfect" which was due to the way the high-pass filter was designed), if the results are very close, they might have a few slight differences compared to the original paper...

felix fangHi, Professor Gilles, I find that the test signals' ewt results in your 2013 paper can not be realized by the 4.0 version with the LP_FilterBank. And I can realize the ewt results through the version with Maeyer_FilterBank.

Is the input parameters which I design or the difference filterbank I use cause this happening?

felix fangdevendra pariharYes, the size of the input signal is 200x1.

Jerome Gilles@devandra: did you load your signal in a vector?

Jerome Gilles@mahima: thanks! I fix that in the next version (hopefully soon!)

devendra pariharI am using a time-series signal for 1D EWT analysis using EWT1D.m function. Under this function, I have to pass to two variables one is signal, and another is parameters. In the parameter, I tried to pass given parameters but I am getting a constant error.

Dot indexing is not supported for variables of this type.

Error in EWT_Boundaries_Detect (line 72)

if params.log==1

Error in EWT1D (line 53)

boundaries = EWT_Boundaries_Detect(abs(ff(1:round(length(ff)/2))),params);

Kindly help me.

Rodrigo Abarca del Rio@Muhammad Tariq Sadiq : ?

Muhammad Tariq Sadiq@Rodrigo Abarca del Rio kindly proposed any new method to remove mode mixing problem,. We will really appreciate

Rodrigo Abarca del RioHi Jerome. Far be it from me to criticize the effort to put these codes online. That's not the idea. However I have found some difficulties in their application. I have the impression that some frequencies or modes are mixed up. Sorry.

mahima tendulkarSir, There is a slight mistake in the function "EWT_Boundaries_Completion" .

In line 26, boundaries = [boundaries ; boundaries(end)+deltaw];

semicolon is missing. Hence, it gives concatenation error.

Jerome Gilles@Muhammad Tariq Sadiq: thanks! I appreciate ;-)

Muhammad Tariq Sadiq@Rodrigo Abarca del Rio: kindly share your matlab codes or toolboxes which you produced that are easy to understand and without parameters. I am sure, you do not know what you commented

@Jerome Gilles: Your codes are very easy to understand, specially the effort you put by providing toolbox is really helpful for us. I am really thankful to you for providing all your help to me in this forum. With your help i am able to publish to quality articles in IEEE journals.

Thanks alot

Jerome Gilles@Rodrigo Abarca del Rio: what do you mean by "difficult"?? The only thing you have to do is call the function by passing your data to it (like any function in any programming language...), difficult to make it easier than that ... Now if by difficult, you mean the choice of the parameters then 1) I provide a function that creates a set of default parameters which work for most situations, 2) if you expect to find a method with zero parameters which will do exactly what you want, I'm sorry to tell my friend that this does not exist ...

Before writing such criticism, it will be more constructive that you give us an idea of what you are trying to achieve, what kind of data you deal with,...

Also, did you read all the papers mentioned above and the documentation provided in the toolbox? Because if you did, and more importantly you understand them, you will realize most parameters can be chosen in a quite pretty logical way ...

oh and by the way, I'm not here to have some "success", I'm a mathematician and the only that interest me is to develop useful methods ... and as speaking of success, as of today almost 700 citations for the original 1D paper alone is not bad ...

Rodrigo Abarca del RioThe code is finally difficult to apply on time series. As it is, with so many parameters to enter into the program, the code is really difficult to apply. That is to say, it should be simplified, or there should be in addition to the code with all those parameters, a basic universal code that allows analyzing any series in a basic way, and that allows the reproducibility simply. This is not the case today and this complicates its use and therefore its success, if that is what the author wanted.

ShaohuaMingyue Wang@Jerome Gilles

Thank you very much.I will try to learn more.Thank you again for your help.

RunfengDear Jerome,

I am trying to process signal 1 in Test_EWT1D.m,but the best result i can get(by locmax) isn't same as what your paper show.And it is even worse than emd's result.The following is what I set,how can I get the better result?And my e-mail is jsfaraway@gmail.com(if it is more convenient for you)please help me,thank you very much!

%4.0 version

% Choose the signal you want to analyze

% (sig1,sig2,sig3,sig4=ECG,sig5=seismic,sig6=EEG,sig7=compplex signal1)

signal = 'sig1';

params.SamplingRate = -1; %put -1 if you don't know the sampling rate

%params.SamplingRate = 4000; %put -1 if you don't know the sampling rate

%channel = 50; %for EEG only

% Choose the wanted global trend removal (none,plaw,poly,morpho,tophat,opening)

params.globtrend = 'none';

params.degree=5; % degree for the polynomial interpolation

% Choose the wanted regularization (none,gaussian,average,closing)

params.reg = 'none';

params.lengthFilter = 10;

params.sigmaFilter = 1.5;

% Choose the wanted detection method (locmax,locmaxmin,

% adaptive,adaptivereg,scalespace)

params.detect = 'locmax';

params.typeDetect='otsu'; %for scalespace:otsu,halfnormal,empiricallaw,mean,kmeans

params.N = 3; % maximum number of bands

params.completion = 3; % choose if you want to force to have params.N modes

% in case the algorithm found less ones (0 or 1)

%params.InitBounds = [4 8 13 30];

params.InitBounds = [2 25];

% Perform the detection on the log spectrum instead the spectrum

params.log=0;

% Choose the results you want to display (Show=1, Not Show=0)

Bound=1; % Display the detected boundaries on the spectrum

Comp=1; % Display the EWT components

Rec=0; % Display the reconstructed signal

TFplane=0; % Display the time-frequency plane (by using the Hilbert

% transform). You can decrease the frequency resolution by

% changing the subresf variable below. (WORKS ONLY FOR REAL

% SIGNALS

Demd=0; % Display the Hilbert-Huang transform (WORKS ONLY FOR REAL

% SIGNALS AND YOU NEED TO HAVE FLANDRIN'S EMD TOOLBOX)

subresf=1;

InitBounds = params.InitBounds;

Jerome Gilles@Mingyue

The scale-space theory is not made only to process spectra, you can eventually apply it directly on a signal. Here I choose to use it on the Fourier spectrum because I'm looking at the "consistent" minima within the spectrum to define my boundaries. This is kind of a general definition of how to find the supports of the relevant subbands, of course for a specific application you might want to use another definition of what is a subband and then develop your own boundary detection method...

Regarding the choice of the Gaussian kernel, in the continuous case, it is the ONLY kernel that satisfies the scale-space axioms. Now in the discrete case, there are several options (I would recommend that you read the literature about the scale-space theory). The discrete version we currently use in the code is supposed to be the one which has the most advantages. Now, yes this corresponds to a low-pass filtering and if there exists a huge set of low-pass filters, only a few of them respect the scale-space theory axioms (which are essentials to guarantee the proper behavior to detect such boundaries).

You mentioned the use of the wavelet transform, this could be an option as well but I never tried it...

Mingyue Wang@Jerome Gilles

In fact, I want to optimize the scale space algorithm, reduce the generation of redundant components, and separate the components with similar frequency. I'd like to ask if it will be better if I replace the Fourier spectrum with wavelet transform and then carry out scale space analysis. I'm going to try again. Can you give me some suggestions? Thank you again.

Mingyue Wang@Jerome Gilles

Thank you very much. I also want to ask you, the scale space is to analyze the Fourier spectrum of the signal to be processed, and I use the power spectrum to replace it. I find that although the power spectrum in the frequency domain can better represent the components with similar frequency, and the noise is also less affected (I see some scholars, use the power spectrum to replace the Fourier spectrum, and then use the extreme value method to divide the frequency band), but for its In scale space representation, many redundant components are still obtained, just like Fourier spectrum.

In this regard, I take the logarithmic coordinates of the power spectrum and find that the power spectrum enlarges the gap between the data, and there is still a large fluctuation in the frequency band without frequency peak

(this is why it is not good for me to use power spectrum as scale space. I don't know if it is correct.)

Mingyue Wang@Jerome Gilles

Thank you very much for your reply.What I want to express is: 1. Is there any other kernel function that can replace Gauss kernel function? 2. If Gauss kernel function is used, whether it can optimize the convolution with signal Fourier spectrum (I'm not sure how to optimize it) can reduce spectrum noise and redundant components.

Thank you.

Jerome Gilles@Mingyue: what do you mean by "improve this part"? what part are you talking about? the current version of the code (which is different from what is described in the paper) uses the discrete Gaussian kernel and sparse matrices to store the scale-space information, this is optimal in term of computing time and used memory. So what do you want to improve? Also what do you mean by "optimizing the gauss kernel"? what kind of optimization are you referring to?

Mingyue Wang@Jerome Gilles

Recently, I have seen some improved methods of the empirical wavelet transform algorithm. I have a question. When using the scale space to divide the boundary, the Gauss kernel function and the Fourier frequency are convoluted, which is actually filtering and smoothing. Please improve this part. Compared with optimizing the Gauss kernel function, which can better suppress the spectrum noise, redundancy can be reduced the generation of components.

I will be eagerly waiting for your reply.

Thank you.

Regards

Pavan MalghanGreetings.

Thank you very much for your reply. As mentioned in the base paper 2013, I have used the "locmax" for boundary detection method with exactly the same number of bands(N) (For eg. ECG signal, N=5) you had mentioned in the base for each and every signal. I kept all the other parameters as it is with respect to particular signals. The plots of EWT and TF are different compared to your paper. So I want to know what exactly the parameters you have chosen to get the same EWT plots and T-F plots as same as your paper.

Jerome Gilles@Pavan: can you be a bit more specific? What are the differences? Did you use the provided test functions to generate those results or did you write your own code? Also which boundary detection method did you use. The default one in the code is not the one used in the original paper ...

Pavan MalghanHello Jerome sir. I am actually trying to simulate your work as it is without changing the parameters. For signals 'sig1' or 'sig2' or any other signals, I am unable to get the exact outputs that you have mentioned in your base paper published in 2013. When I compare the EWT components and the TF plots with that of paper, it is totally changing. Please suggest the exact values you used so as to reproduce the exact same output waveforms given in your paper. (I have used N=2 for 'sig1', N=3 for 'sig2' and so on respectively as you had mentioned in the papers. But couldn't get the results). I will be eagerly waiting for your reply.

Thank you.

Regards

Pavan Malghan

Jerome Gilles@Frank Martin: I don't have the time to read the paper in details but from what I can see browsing it, is that they do the empirical wavelet transform (which you can indeed perform using my toolbox) and create some sort of time-frequency plane. I don't know if this time-frequency plane is the same as the one provided by my function though, you have to dig on that...

GB_2020Hi Jerome, I am a student doing my Bachelor's project on fault diagnosis of 3 phase induction motor using deep learning. I read a paper called Fault Diagnosis System for Induction Motors by CNN Using Empirical Wavelet Transform,'https://www.mdpi.com/2073-8994/11/10/1212/htm ' . Basically they used EWT to get 2D gray scale images and performed deep learning. Now, I have no clue how they implemented EWT in that. Can you check it out and see if its possible to use this MATLAB toolbox to refine signals into 2D gray scale images. If so, any feedback would be highly appreciable since this is my first major project.

Thanks and have a great day.

Jerome GillesHi all, as promised, I just uploaded version 4.0 of the EWT toolbox! Read above to see several major changes and new functionalities. As usual, if you find any bug, please let me know ;-)

Jerome GillesBtw, if you are new and planning to try it soon (ans also for the current users), I will suggest that you wait a bit since I'm planning to release a new major version of this toolbox (hopefully within the next two weeks) where a lot of improvements have been made (the 1D function will deal with complex signal, i,e non symmetric spectrum, optimized 2D code and some bug fixes)

Jie RenCould one confirm that the frame is not only tight but also orthogonal?

ChengWavelet_TransformI have solved the problem, thank you very much！

Jerome Gilles@Wavelet_Transform: and what are those dimensions? Isn't it that one is horizontal vector while the other one is a vertical one? In such case, doing the transform of the transpose of your signal might solve the problem... Otherwise, it would be great if you could send me your code and your signal so I can test it myself.

Wavelet_Transform@Jerome Gilles:yes，This error appears in the new and old versions

Jerome Gilles@Wavelet_Transform: did you try it with the new version I uploaded today?

Wavelet_TransformDear Jerome ，

When I call this function of Modes_EWT1D, an error is displayed, content is that the dimensions of the matrix are inconsistent. I carefully checked the code and found that the dimensions of ewt and mfb are different.

for k=1:length(ewt)

ewt{k}=[ewt{k}(l-1:-1:1);ewt{k};ewt{k}(end:-1:end-l+1)];

rec{k}=zeros(length(ewt{1}),1);

rec{k}=real(ifft(fft(ewt{k}).*mfb{k})); % the dimensions of the matrix are inconsistent

rec{k}=rec{k}(l:end-l);

end

Muhammad Tariq Sadiq@Jerome Gilles , Thank you very much for your reply and fixing the bugs in the toolbox, I will follow your instructions and if problem is not solved will also send you the signal.

Jerome GillesTO ALL: UPDATE YOUR TOOLBOX!

I just uploaded a new version fixing some bugs, in particular a mistake was made in the construction of the 1D filters such that when you performed the inverse transform there was a pretty "large" error. This is now fixed and this bug was also affecting the extracted components so don't be surprised if they look slightly different than from previously.

Jerome Gilles@Muhammad Tariq Sadiq: can you send me the signal you are using so I can backtrack the error? I'm wondering if it could be a bug when the signal length is odd, could you eventually retry the algorithm by removing one sample from you input signal?

Wavelet_TransformWhy there is no difference between wavelet coefficient 'ewt' and reconstructed signal 'rec' in the program

Muhammad Tariq SadiqDear Jerome,

I have decomposed a signal into in modes. Let suppose I have ewt1 where each mode in EWT1 has following dimensions

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

Where the length of boundary (B) is 1 x9 double.

When I run following command

Hilb1=EWT_InstantaneousComponents(Ewt1,B');

I am getting following errors

Index exceeds array bounds.

Error in IFcleaning (line 32)

if ind(1)~=1

Error in EWT_InstantaneousComponents (line 47)

Hilb{i}{2}=IFcleaning(diff(unwrap(angle(ht))),(1-gamma)*boundaries(i),(1+gamma)*boundaries(i+1));

Please guide me how to remove above errors?

arbur liuMinghangWenzhan Yang@Gilles: The modifications just provide a simpler way to perform the calculation. From the coding perspective, It simplifies the judgement of terminating condition and reduces unnecessary duplication in the original version. In fact, your version and mine will actually give the same results on all cases.

By the way, the code I provided should be corrected in Line 18, 'elseif i0 < size(plane,1) && plane(i0+1,j0) == 1', and from Line24 to 26, a 'end' should be made redundant.

Jerome Gilles@Wenzhan: can you provide a description of the modifications you made? Did you check (on many "not easy" cases) that your version and mine give exactly the same results?

Wenzhan Yang@Gilles, Thanks for your response. I just want to share a simpler and clearer version of the function 'LengthScaleCurve.m'. I think it's helpful for people gonna use it, so the code is shared. It doesn't matter if you don't have time to analyze it, and I hope it will be checked by communities. Thanks again.

Jerome Gilles@Wenzhan: I'm not sure to understand ... what did you do? When you post some code, please explain what it is/does and what you expect from me because I don't have the time analyze it line by line ...

Wenzhan YangDear Gilles:

Thanks for your sharing, and a simpler version of function 'LengthScaleCurve.m' in the toolbox suggested:

function [Length,indices] = LengthScaleCurve(plane)

Ncurve = sum(plane(:,1));

Length = ones(Ncurve,1);

indices = zeros(Ncurve,1);

ic = 1;

for i = 1:size(plane,1)

if plane(i,1) == 1

indices(ic) = i;

i0 = i; j0 = 2;

while j0 <= size(plane,2)

if plane(i0,j0) == 1

Length(ic) = Length(ic) + 1;

j0 = j0 + 1;

elseif i0 > 1 && plane(i0-1,j0) == 1

Length(ic) = Length(ic) + 1;

j0 = j0 + 1;

i0 = i0 - 1;

elseif i0 < size(plane,2) && plane(i0+1,j0) == 1

Length(ic) = Length(ic) + 1;

j0 = j0 + 1;

i0 = i0 + 1;

else

break;

end

end

end

ic = ic + 1;

end

end

Is the modification appropriate? Hope to get your response.

Jerome Gilles@xiaofang: what do you mean by "I can't get results like those in your paper"? Do you have any error message? which paper are you referring to? If it is the original paper then experiments in this paper were not using the scale-space method ...

xiaofangDear Gillies，Firstly，thanks for your sharing ，then when i use the toolbox-EWT1D，I can't get results like those in your paper.Here is my parameter settings .

% Choose the signal you want to analyze

% (sig1,sig2,sig3,sig4=ECG,sig5=seismic,sig6=EEG)

signal = 'sig4';

params.SamplingRate = -1; %put -1 if you don't know the sampling rate

% params.SamplingRate = 4000; %put -1 if you don't know the sampling rate

channel = 50; %for EEG only

% Choose the wanted global trend removal (none,plaw,poly,morpho,tophat)

params.globtrend = 'none';

params.degree=6; % degree for the polynomial interpolation

% Choose the wanted regularization (none,gaussian,avaerage,closing)

params.reg = 'none';

params.lengthFilter = 10;

params.sigmaFilter = 1.5;

% Choose the wanted detection method (locmax,locmaxmin,ftc,

% adaptive,adaptivereg,scalespace)

params.detect = 'scalespace';

params.typeDetect='otsu'; %for scalespace:otsu,halfnormal,empiricallaw,mean,kmeans

params.N = 4; % maximum number of bands

params.completion = 0; % choose if you want to force to have params.N modes

% in case the algorithm found less ones (0 or 1)

% params.InitBounds = [4 8 13 30];

params.InitBounds = [2 25];

% Perform the detection on the log spectrum instead the spectrum

params.log=1;

% Choose the results you want to display (Show=1, Not Show=0)

Bound=1; % Display the detected boundaries on the spectrum

Comp=1; % Display the EWT components

Rec=1; % Display the reconstructed signal

TFplane=1; % Display the time-frequency plane (by using the Hilbert

% transform). You can decrease the frequency resolution by

% changing the subresf variable below.

Demd=0; % Display the Hilbert-Huang transform (YOU NEED TO HAVE

% FLANDRIN'S EMD TOOLBOX)

subresf=1;

InitBounds = params.InitBounds;

Jerome Gilles@Stephen: I see only two possibilities: 1) it is a Matlab configuration issue and thus you should ask people around you if there's any trick you have to use in your environment. 2) you are not calling the function properly, did you check the syntax? If you could send me a copy of your code where you call that function, that could help.

Stephen Lopez@Jerome yes sir plenty of times. some of the other functions work perfectly fine.

Jerome Gilles@Stephen: did you set the PATH to the EWT folder and its SUBFOLDERS?

Stephen Lopez@Jerome dear sir I have set the path countless times but I still get the "Undefined function or variable 'EWT1D'." error is this some sort of bug?

Jerome GillesDear all, sorry for the late reply, my schedule is turning me crazy! Anyway, here are some answers to your respective questions:

-regarding the instfreq function, it is supposed to be part of the signal processing toolbox ...

-regarding the seismic signal in the example, it is part of the IRIS data (https://ds.iris.edu/ds/nodes/dmc/data/types/events/) but I don't remember which signal exactly.

-@qifan: if you don't know the expected number of modes, the only reliable method to use is the scale-space method.

qifanDear Gilies,how to use the threshold method mentioned in your article'Empirical Wavelet Transform' to choose the number of modes through your toolbox,if scale-space option is better than the method?

Abhishek sadasivan@Jerome, Sir I saw a seismic signal in your package in example section. Can you tell me some details about that, How to cite that data

Abhishek sadasivan@Jerome, Sir I saw a seismic signal in your package in example section. Can you tell me some details about that, Whether I can use it in my papers with reference ?, whether it is an openly available for public? I am currently working on seismic analysis and I dont have original data,

Abhishek sadasivan@yan damon

Kindly refer to below conversations and please let me know how you have sorted that issue. I am getting the same error as you commented on 17th January , While comparing EWT with EMD, I am getting the error some 'TFD should be positive in instfreq. From you comments I understood that the instfreq mentioned in hhspectrum.m is different from the one used in matlab, but I dont know how to solve the issue.. I didn't find any other instfreq function in the package. Will you help me please...

Jerome GillesDear Muhammad, sorry but I'm very busy right now ... I will probably not be able to check it until a few weeks ...

Muhammad Tariq Sadiq@Jerome Sir, Kindly reply me when you get a chance, thank you

Muhammad Tariq SadiqDear Jerome,

I have decomposed a signal into in modes. Let suppose I have ewt1 where each mode in EWT1 has following dimensions

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

67x1 double

Where the length of boundary (B) is 1 x9 double.

When I run following command

Hilb1=EWT_InstantaneousComponents(Ewt1,B');

I am getting following errors

Index exceeds array bounds.

Error in IFcleaning (line 32)

if ind(1)~=1

Error in EWT_InstantaneousComponents (line 47)

Hilb{i}{2}=IFcleaning(diff(unwrap(angle(ht))),(1-gamma)*boundaries(i),(1+gamma)*boundaries(i+1));

Please guide me how to remove above errors?

Muhammad Tariq SadiqJerome GillesDear Muhammad,

I'm not an expert in real time coding so it is difficult for me to reply this question...

It is sure that some parts of the code might not be easy to code in real time but some specific strategy could probably be developed to leverage these difficulties.

Muhammad Tariq Sadiq@Jerome Gilles Can this method be implemented in real time environment / real time applications? or it is only for batch processing?

Jerome GillesDear Abhishek, I don't know why my response was deleted but I answer that you should contact Yan since he said he found the right function to use so he may tell you what solution he found ...

Abhishek sadasivan@Jerome Gilles;Thanks for sharing.. I am getting the same error as yan damon commented on 17th January , While comparing EWT with EMD, I am getting the error some 'TFD should be positive in instfreq. From below comments (Comments from yan damon) I understand that the instfreq mentioned in hhspectrum.m is different from the one used in matlab, but I dont know how to solve the issue.. I didn't find any other instfreq function in the package provided by you. Will you able to help me n this issue.. please give me replay

Jerome Gilles"Wavelet_Transform", it is not the method which limit the number of samples but your computer and more specifically the amount of memory you have ...

Wavelet_TransformCan this method process a long time signal segment such as 1000000 samples?

Abhishek sadasivan@Jerome Gilles;Thanks for sharing.. I am getting the same error as yan damon commented on 17th January , While comparing EWT with EMD, I am getting the error some 'TFD should be positive in instfreq. From below comments (Comments from yan damon) I understand that the instfreq mentioned in hhspectrum.m is different from the one used in matlab, but I dont know how to solve the issue.. I didn't find any other instfreq function in the package provided by you. Will you able to help me n this issue..

Jerome GillesDear Sai, read the documentation and check the Test_EWT2D_LP.m in the Tests/2D folder ...

Sneha KDear Gilies, i want to run the code "EWT 2D LITTLEWOOD PALEY" for colour image. Is it possible?

I got the result for gray image.

shuting HUANGDear Gillies，Firstly，thanks for your sharing ，then when i use the toolbox-EWT1D，I can't get results like those in your paper.Here is my parameter settings .

% Choose the signal you want to analyze

% (sig1,sig2,sig3,sig4=ECG,sig5=seismic,sig6=EEG)

signal = 'sig3';

params.SamplingRate = -1; %put -1 if you don't know the sampling rate

%params.SamplingRate = 4000; %put -1 if you don't know the sampling rate

% channel = 50; %for EEG only

% Choose the wanted global trend removal (none,plaw,poly,morpho,tophat)

params.globtrend = 'none';

params.degree=6; % degree for the polynomial interpolation

% Choose the wanted regularization (none,gaussian,avaerage,closing)

params.reg = 'none';

params.lengthFilter = 10;

params.sigmaFilter = 1.5;

% Choose the wanted detection method (locmax,locmaxmin,ftc,

% adaptive,adaptivereg,scalespace)

params.detect = 'scalespace';

params.typeDetect='otsu'; %for scalespace:otsu,halfnormal,empiricallaw,mean,kmeans

params.N = 2; % maximum number of bands

params.completion = 0; % choose if you want to force to have params.N modes

% in case the algorithm found less ones (0 or 1)

%params.InitBounds = [4 8 13 30];

% Perform the detection on the log spectrum instead the spectrum

% 对数谱进行检测而不是谱

params.log=0;

shuting HUANGDear Gillies，Thanks for your reply，I also have some question ，what is the initial boundaries，sorry i have read the documentation，but I still can“t understand 。

sai priyahow to run this code "EWT 2D LITTLEWOOD PALEY"

Sanchay GuptaI have sent you the image on jgilles@mail.sdsu.edu. Thank you for your help

Jerome GillesI never see this error ... could you send me by email this image '01_g.jpg' so I can try your code on my own?

Sanchay GuptaThis is my entire code

Image_read=imread('01_g.jpg');

Image_resized= imresize(Image_read, [256 256])

Image_green= Image_resized(:,:,2);

%%a = zeros(size(Image_resized, 1), size(Image_resized, 2));

%%just_green = cat(3, a, Image_green, a);

imshow(Image_green);

J= adapthisteq(Image_green,'clipLimit',0.02,'Distribution','rayleigh');

j2=medfilt2(J)

params.globtrend = 'tophat';

params.degree=5; % degree for the polynomial interpolation

% Choose the wanted regularization (none,gaussian,average,closing)

params.reg = 'gaussian';

params.lengthFilter = 10;

params.sigmaFilter = 1.5;

% Choose the wanted detection method (locmax,locmaxmin,ftc,scalespace)

params.detect = 'locminmax';

%params.typeDetect='otsu';

params.N = 4; % maximum number of band for the locmaxmin method

params.log=0;

params.completion = 0;

%% We perform the 2D Littlewood-Paley EWT

[ewtc,mfb,boundaries]=EWT2D_LittlewoodPaley(j2,params);

I am Still getting the following error

Output argument "boundaries" (and maybe others) not assigned during call to "EWT_Boundaries_Detect".

Error in EWT2D_LittlewoodPaley (line 59)

boundaries = EWT_Boundaries_Detect(meanppfft(1:round(length(meanppfft)/2)),params);

Error in ewt (line 35)

[ewtc,mfb,boundaries]=EWT2D_LittlewoodPaley(j2,params);

Jerome GillesDear Sanchay,

First, there is a typo when you set params.reg, it should be gaussian not guassian ...

Second, why are you running the fft before calling the function EWT2D_LittlewoodPaley? If you read the documentation, the first parameter in this function is supposed to be the image not its Fourier transform (except if you really want to decompose the Fourier transform?)...

Sanchay GuptaDear Jerome I want to perform a single level 2D EWT on my image using the following parameters

params.globtrend = 'tophat';

params.degree=5; % degree for the polynomial interpolation

params.reg = 'guassian';

params.lengthFilter = 10;

params.sigmaFilter = 1.5;

params.detect = 'locminmax';

and i used the function call as [ewtc,mfb,boundaries]=EWT2D_LittlewoodPaley(f,params) after running fft on my image.

But I am getting the following error:

Output argument "ff" (and maybe others) not assigned during call to "SpectrumRegularize".

Error in EWT_Boundaries_Detect (line 80)

presig = SpectrumRegularize(presig,params);

Error in EWT2D_LittlewoodPaley (line 59)

boundaries = EWT_Boundaries_Detect(meanppfft(1:round(length(meanppfft)/2)),params);

Error in ewt (line 34)

Could you help me debug it by sending a sample code on how to run the function on a image.

my email id is :sanchay.gupta2015@vit.ac.in

Jerome Gillesjust modify the 4th line and define your own x ;-)

Muhammad Tariq SadiqDear Jerome, hope you are fine. I need help regarding plotting of modes for samples on x-axis, instead of normalize time between 0 and 1. I know following function is used for the plotting. Can you please suggest me where should i made changes to have samples like (0,50,100, 200 etc) on x-axis instead of (0.1, 0.2......1). Kindly suggest

function Show_EWT(ewt,f,rec)

%These lines plot the EWT components

figure;

x=0:1/length(ewt{1}):(length(ewt{1})-1)/length(ewt{1});

l=1;

if length(ewt)>6

lm=6;

else

lm=length(ewt);

end

for k=1:length(ewt)

hold on; subplot(lm,1,l); plot(x,ewt{k}); %axis off;

if mod(k,6) == 0

figure;

l=1;

else

l=l+1;

end

end

%These lines plot f and its reconstruction

if nargin>1

figure;

subplot(2,1,1);plot(x,f);

subplot(2,1,2);plot(x,rec);

end

shuting HUANGThank you for your reply！！！

Jerome Gillesthe number are initial boundaries, they are between 0 and pi since the frequencies are normalized in that range.

this can be used only with the boundary detection method called "adaptivereg"

... check the documentation!

shuting HUANGshuting HUANGDear Gillies，Thanks for your sharing，I also have some question about the params：params.InitBounds =【，】，How do the numbers in parentheses come from?，Could you tell me the meaning，thank you very much。

yan damonDear jeromo, Thanks for your prompt reply, I have found the reason. I got the error at line 79 in the hhspectrum function, which gives me an error(Matlab told me something called TFD should be positive in instfreq). And I found some other people got this error on the web. Finally, I found it is owing to the function instfreq. There is an instfreq function in Matlab software, which is different with the instfreq function in hhspectrum.m. So matlab gave me that error. Thanks again!

Jerome GillesYan, which function is giving you that error?

yan damonDear Jeromo, I have been trying to use your toolbox to compare EWT with EMD, but I found that when I tried to use the EMD method as I set the parameter to be 1,but it went wrong. Matlab told me something called TFD should be positive in instfreq, would you mind helping me with this ? It's confusing.

(Demd=1; % Display the Hilbert-Huang transform (YOU NEED TO HAVE FLANDRIN'S EMD TOOLBOX))

yan damonJuntao lengshuting HUANGJerome GillesSatvika, you get an error on line 30 but line 30 of which function?

Also it is not clear to mean why you say to have 100 modes but only 10 boundaries ...

Jerome GillesPiotr, what do yo mean by "the result is an input signal and signals approximately equal to zero", the input signal is not supposed to change...

Piotr KuwalekDear Jeromo, I wanted to use EWT in electrical engineering to recognize sources of interference. I downloaded the toolbox you shared, and started with the test file. Of course, I was able to get the right fashions for the test signals you created in the publication. Next, I generated my test signal f: t=(0:1/2000:0.1*60-1)'; f=0.1*sin(2*pi*5*t)+0.08*sin(2*pi*10*t)+0.05*sin(2*pi*15*t); , but after using the function ewt1d for my function f, the result is an input signal and signals approximately equal to zero. Thus, in the obtained mode decoposition, it does not get any sinusoidal signals in approximation. Could you tell me which parameter I need to change in order to be able to get individual components in the mode decomposition?

Piotr KuwalekThere is an error in my comment, the word 'fashion' has to be replaced with the word 'mode'.

Satvika AnandHey Jerome, I am trying to implement your ewt toolbox to detect epileptic seizure in patients. I am able to find 10 modes of ewt using Ewt1D function. But when I am attempting to find Hilbert transform , it shows an error in EWT_Instantaneous components function, stating error in line 30 saying that vertcat is not possible .Please help me resolve this issue. Also since no. of modes found is 100 so we need 10 boundaries instead of 9 which I am getting presently.

shuting HUANGDear Jerome , thanks for your sharing

shuting HUANGWentao ZhaoWentao ZhaoMuhammad Tariq SadiqThank you very much for your help :)

Jerome Gilleswhen the plots are in the Fourier domain, the normalization is [0,pi] and when you plot the modes, these are in the time domain and the axis is normalized in [0,1]

It depends which domain you are talking about.

Muhammad Tariq SadiqDear @Jerome thank you for your reply and apologize for posting same questions several times. However, I am little confuse from your answers, first you said we have normalize values on x-axis between [0,pi] which means our x-axis represents frequency whereas in your latest answers you said we have normalization values between [0,1], which represents we have time on x-axis. Kindly help me to confirm how to label x-axis in figures, should i write normalize time or frequency on x-axis.

Thanking you for helping me alot

Jerome GillesDear Muhammad,

I don't know what happened, it sounds like response didn't show up: right now the Show_EWT function uses a normalization between [0,1] of the horizontal axis. If you want to the actual time, you need to modify how the vector x is created in that function.

I will add such functionality in a future version ;-)

PS: you don't need to post several times the same message!

Muhammad Tariq SadiqDear @Jerome thank you for the reply. I am using EWTDefaultParams(); function and in this function I have change the value of params.SamplingRate to 100 Hz from -1 (which we use if we do not know the sampling rate ) . After that I use the following command to plot the modes Show_EWT(ewt). It is still showing my X-axis of each mode contains values like [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]. Can you please suggest me where is the problem?

Jerome Gillesbtw, I'll keep that in mind and will add such functionality in a future version ;-)

Muhammad Tariq SadiqDear @Jerome thank you for the reply. I am using EWTDefaultParams(); function and in this function I have change the value of params.SamplingRate to 100 Hz from -1 (which we use if we do not know the sampling rate ) . After that I use the following command to plot the modes Show_EWT(ewt). It is still showing my X-axis of each mode contains values like [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]. Can you please suggest me where is the problem?

Muhammad Tariq SadiqDear @Jerome thank you for the reply. I am using EWTDefaultParams(); function and in this function I have change the value of params.SamplingRate to 100 Hz from -1 (which we use if we do not know the sampling rate ) . After that I use the following command to plot the modes Show_EWT(ewt). It is still showing my X-axis of each mode contains values like [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]. Can you please suggest me where is the problem?

Jerome Gilleswhen you plot the modes themselves and if you didn't specify what was the sampling frequency then the time axis is normalized between 0 and 1.

Yes the y-axis corresponds to the amplitude of the modes.

Muhammad Tariq Sadiq@Jerome as I understand X-axis of modes are normalize values between [0,pi] whereas y-axis represents amplitude?

Muhammad Tariq Sadiqhello @Jerome thank you for the prompt reply, however I did not understand what my x-axis and y-axis represents? can you please explain. X-axis of each mode contains values like [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]. Looking forward to hear

Jerome GillesHi Muhammad,

The function normalizes the detected boundaries in [0,pi] ;-)

Muhammad Tariq Sadiqhello jerome. I have used EWT for EEG signal decomposition. I have used locmaxmin parameter and select 10 modes for my experiment. I have successfully got 10 modes, however I have on query in my mind. X-axis of each mode contains values like [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]. As per my knowledge, x-axis of each mode represents sample numbers and values like [100. 200. 300. ............500 etc]. Please suggest me x-axis of my experiment modes make any sense to you? Looking forward to hear from you. Thank You

Jerome Gillesno idea, I don't have this version of Matlab, you have to try it!

anupalli yamunais this toolbox working on matlab 2015a

zhaolanglang01Jerome Gillesdid you setup the paths? Again see the readme file and the documentation ...

JAYAKUMAR C SoC RADear Jerome,

I am getting this error while I try to run the TESTEWT_1D could you please guide me to work with your code. I tried this in both MATLAB 2014a and 2017b.

Undefined function 'EWT_Boundaries_Detect' for input arguments of type 'struct'.

Error in EWT1D (line 51)

boundaries = EWT_Boundaries_Detect(abs(ff(1:round(length(ff)/2))),params);

Error in Test_EWT1D (line 92)

[ewt,mfb,boundaries]=EWT1D(f,params);

Aaron PhanNoted with thanks!

Jerome Gillesnot in this method (it's the point of this method: it is parameterless).

now if you use another method, you can play with the parameters (read the documentation and the papers!).

Aaron PhanHi Jerome,

Thanks for the swift reply again.

Is there any parameters that i can currently set to reduce the processing time of the code from the default detection method?

Best Regards,

Aaron

Jerome Gilleswell if you use the default detection method, i.e the scale-space method, it requires quite some memory to run this method. That being said I expect to be able to release a modified version which will use less memory in the future.

Aaron PhanThe same one as in your Test_EWT1D.m example. But after reducing the sample to 50000 data points, the code runs fine. Still trying to comprehend your toolbox here. Big thanks for the prompt reply.

Jerome Gillesyou get that message only when using my toolbox? If yes, which boundary detection method are you using?

Aaron PhanHi Sir,

Thanks for your swift reply, i don't get why matlab shows that error message as my input 1D bearing signal only consisted of 1048500x1 double with a sampling rate of 1M sample per second.

Any recommendations?

Thanks again.

Jerome GillesHi Aaron,

Your matrix has a size of 682.6Gb?? No standard computer can handle such big matrix! You either need to access a supercomputer or find a way to process this by cutting it into pieces ...

Aaron PhanHi Sir,

For this code how do i solve the error if the input is too large (AE Signal) and matlab produces the error message of " Error using zeros

Requested 524250x174751 (682.6GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information."

Thanks in advance.

annthank you sir

Jerome GillesDear Ann,

When I said people already used it to denoise some signal, I meant 1D signals. I saw a couple of papers doing so you could easily find them via google.

That being said, the principle is almost always the same (as for 2D): based on thresholding the wavelet coefficients.

Btw, we showed such example in our 2D paper.

annDear Jerome Sir，thank you for your help, I have read your article before, this method is used in the field of image processing. differently, the signal which i want to de-noising is one dimensional static signal in the time domain, so i don't know whether to use the algorithm to do it, in addition to the application of the denoising technology you mentioned here, is the practical use of engineering or laboratory exploration, Thank you for your reply again.

Jerome GillesDear Ann,

A priori yes, some people already used it to denoise some signals ;-)

annDear Jerome Sir,i would want to know if this algorithm can be used to denoise the static signal, as previous research shows that the noise in the signal can be de-noised by using EMD and wavelet de-noising. and now i want to use the EWT and the wavelet threshold to achieve the signal de-noising. thank you very much for your work.

Jerome GillesYes of course you can do that but the purpose of the EWT is specifically to automatically detect the frequency bands ...

If you force the frequency bands it is no longer "Empirical" but a standard filtering. If you want to do that with the EWT filters, you have to remove the boundaries detection part and provide your own bands.

Now, I have a doubt, are you saying that you have another process which extract these subbands and you want to apply the EWT to each of them? If so then the output of each subband is itself a signal so you only need to call the EWT function for each one ...

Alcatraz ProphetDear Jerome Sir, I am a second year engineering undergraduate student and currently new to this field. I have read your paper on Empirical Wavelet Transform(EWT), and its a great technique. I wanted to ask you whether we can apply EWT in such a way that it gives us components in a particular range directly, say 8 to 40Hz. If so also tell me how can we get components of defined sub bands range, say 8 to 12, 12-16,16-20 Hz etc.

Alcatraz ProphetAnd how can we apply EWT on those extracted sub bands?

Jerome Gilleswell that completely depends on the signal you are analyzing ...

I mean it does not exist any theoretical result saying that the EWT must provide less modes than the EMD ...

SN SJJDear Jerome,I used scale-space to process signal, the number of modes decomposed by EWT is more than that of EMD. But I read the literature, EWT should get less modes than EMD.

Jerome Gillesif you left the default boundaries detection method to scale-space then it is normal since that method does not take into account a prescribed number of modes but automatically finds that number.

Read the documentation, the role of each parameters is explained ;-)

SN SJJDear Jerome, I run Test_EWT1D.m, the signal was decompose to 26 modes, it not fit the setting params.N = 3,

Muhammad Tariq SadiqThank you for the guidelines and the corrections :)

Jerome Gillesthat sounds correct ;-)

Muhammad Tariq SadiqDear Jerome, Thank you for your reply and I think I got your point. I have to decompose all the channels with one single generate filter bank. In this way all the modes will be same and modes generate for each channel will have same frequency support in each oscillatory level. I have implemented code like following. Please let me know is it a right way to proceed?

%% I have two channels i.e. A52 and A54

%% FFT

AF52=fft(A52);

AF54=fft(A54);

%% Mean spectrum Amplitude

ms=(abs(AF52)+abs(AF54))/2;

%% Boundaries

boundaries = EWT_Boundaries_Detect(ms(1:round(length(ms)/2)),params);

B= boundaries*2*pi/length(ms);

% We build the corresponding filter bank

mfb=EWT_Meyer_FilterBank(B,length(ms));

% Decompose channel 52 with the generated filter bank

ewt52=cell(length(mfb),1);

for k=1:length(mfb)

filter=repmat(conj(mfb{k}),1,size(AF52,2));

ewt52{k}=real(ifft(filter.*AF52))';

end

% Decompose channel 54 with the generated filter bank

ewt54=cell(length(mfb),1);

for k=1:length(mfb)

filter=repmat(conj(mfb{k}),1,size(AF54,2));

ewt54{k}=real(ifft(filter.*AF54))';

end

Jerome GillesDear Muhammad,

If A52 is a SINGLE signal then your code does not make sense since your meanfft52 will be a single number ...

Muhammad Tariq SadiqMuhammad Tariq SadiqDear Jerome,

Thank you very much for the clarification. I have followed your steps.

Let suppose A52 is the channel number 52 then I have applied following code according to your instructions. Please let me know is it the right way to proceed?? I think I must follow the same steps for other channels in which I am interested. Looking forward to hearing from you.

%% For Channel 52

%% FFT

AF52=fft(A52);

%% FFT Magnitude Mean

meanfft52=sum(abs(AF52),2)/size(AF52,2);

%% Boundaries

boundaries = EWT_Boundaries_Detect(meanfft52(1:round(length(meanfft52)/2)),params);

B52 = boundaries*2*pi/length(meanfft52);

% We build the corresponding filter bank

mfb52=EWT_Meyer_FilterBank(B52,length(meanfft52));

% We filter the signal to extract each subband

ewt52=cell(length(mfb52),1);

% Show_EWT(ewt52);

for k=1:length(mfb52)

filter=repmat(conj(mfb52{k}),1,size(AF52,2));

ewt52{k}=real(ifft(filter.*AF52))';

end

Jerome GillesDear Muhammad,

If you run [ewt,mfb,boundaries]=EWT1D(fft (channel1),params); it means that you will decompose the fft into modes which is one what you want. The EWT1D function take the original signal as its input, not an FFT.

The 1D provided function do not do what I suggested. You have to write a modified version.

The best way to do it is to look at the 2D Tensor function. If you look at the code, you'll that there is too main steps: processing the row and the column separately. What you have to do is simply remove every lines which related to the column processing (I'm assuming that you cast all your channels as rows in a matrix).

Does that make sense?

Muhammad Tariq SadiqKindly guide me which function in documentation should i use to perform the Fourier modes supports detection on the average the spectra of each channel?

Muhammad Tariq SadiqDear Jerome, If I am not wrong so basically first I should obtain fourier spectrum of each individual channel by using fft. After that I should apply the following command

[ewt,mfb,boundaries]=EWT1D(fft (channel1),params);

to obtain modes?

Is it the right way to proceed?

Jerome GillesDear Muhammad,

A priori no, there is no reason that each channel will have modes with similar frequency supports... That's the aim of such adaptive method: to adapt itself to the processed signal.

Now that being said, if you really want to use a common set of EW filters, what you can eventually do (and I'm NOT saying it necessarily the best thing to do, it depends on your signals) is to perform the Fourier modes supports detection on the average the spectra of each channel (this basically what is done in the 2D tensor case)

Muhammad Tariq SadiqHello Jerome, I would like to ask one query. Kindly reply accordingly. I have used 3 EEG Channels and I have used locmaxmin parameter to select maximum number of modes for each channel to 10. I would like to ask, Do the Modes generated for each channel will have same frequency support in every oscillatory level? or frequencies of the MODEs falling in the same level for

each individual channel are sufﬁciently close together? I am asking this question because I want to make joint mode e.g. mode1 of channel+mode1 of channel2+mode1 of channel 3. Is it possible?

zhangJerome GillesSee the documentation of the function Adaptive_Bounds_Adapt.m

params.InitBounds if just a vector containing the initial bounds you want to use (see the example in the test directory).

then the function finds the actual local minima in the neighborhood of the initial ones.

imran fahadHow to set the "params.InitBounds" parameter and how does it affect the computation ?

I have not found enough explanation in the toolbox manual.

Jerome Gillesa global trend is when you spectrum looks like variation along a certain function.

read the first part of the 2D EWT paper, everything is explained there ;-)

zengjiale zengwhat's mean of 'global trend removal'?

Jerome GillesRead the documentation! Everything is inside...

zengjiale zeng% We filter the signal to extract each subband

ewt=cell(length(mfb),1);

for k=1:length(mfb)

ewt{k}=real(ifft(conj(mfb{k}).*ff));

ewt{k}=ewt{k}(l:end-l);

end

In the program of EWT1D,we know that ewt is a set of the decomposed components,but how can I get the approximate coefficients and detail coefficients? I urgently need your answer. Thanks sir!

Jerome GillesDear Wanx,

If you choose to use a prefix number of modes then this number completely depends on your signal/application and it is up to you to choose it.

Now if you have absolutely no idea about the number of modes, I would recommend that you use the scale-space method instead (see the documentation) which finds automatically an appropriate number of modes.

wanxi19960713Dear Jerome Gulles，

I am interested in your program, and i am writing to request your assistance. In the following code:

params.detect = 'adaptivereg';

params.N = -1; % maximum number of bands

params.InitBounds = [10 25 75 100];

InitBounds = params.InitBounds;

How is the parameter in the parameter matrix of initial boundary initBounds determined?

It would be much appreciated if you can reply me about this, thanks in advance.

atul vermasir,

Thanks for your response

I am not understand please tell me that your designed empirical wavelet transform is a non-separable or separable wavelet transform.

or non-tensor wavelet transform is present in your ewt toolbox

sir please tell me and clear my doubts

Jerome GillesDear Atul,

Usually the notion of separable filters is for filters in dimension larger or equal to 2 since the idea is to have the filters of several variables be a product of one filter with respect each variable. So the separable filters does not make sense in 1D ...

Otherwise, in my toolbox, as of now, there's only one 1D filter (hopefully some new ones soon ;-) )

atul vermasir you have designed many wavelets. which wavelet is non separable wavelet transform to processed 1 dimensional signals. please suggest me.

thanks

Wavelet_TransformHello Gilles,can you tell me how can we get the detail coefficients and approximation coefficients in this EWT package？

Wavelet_TransformI see, it's because that the matrix doesn't turn into an inverse one.

Jerome Gilleswhere comes from these lines?

Wavelet_Transforml=round(length(f)/2);

f=[f(l-1:-1:1);f;f(end:-1:end-l+1)];

who can tell me why here appear an error:the dimensions of the series of matrices are inconsistent.

Jerome GillesDear Liu Lin, in the paper "Empirical Wavelet Transform" I didn't use the scale-space method since this one was developed afterward. I used the approach where I manually set the number of modes.

Take a look in the provided documentation to see which parameters you have to change if you want to be in that case.

liu linDear Jerome Gulles, I use the scale-space and ostu mode to test, but I can not get the same result as your paper "Empirical Wavelet Transform", I make a test on sig2, and just get 3 part segments from the original signal , but in your paper it is 4 parts. Can you tell me how to set the main params in your paper "Empirical Wavelet Transform"? Thank you ! My email is : azyslzp@sina.cn.

Jerome GillesI'm confused, are you using the scale-space method or the original one described in the Empirical Wavelet paper?

The scale-space method does not have any parameter...

heyangyangI am confused about the VI part" Automatic Delection of the Number of Modes" in the paper “Empirirical Wavelet Transform” . You mentioned that "the values of alpha around 0.3 and 0.4 seems give consistent results ". I want to know how to set alpha.Thus I can get little and proper modes automatically.

Jerome GillesDear heyangyang,

Which paper are you talking about? The paper about the scale-space method does not contain any alpha variable ...

heyangyangDear Sir

I have tried my data using your methods.I always get to much mode(using scalespace).I noticed that "alpha can affect the number of detected bands for each signal" in your paper. I wondered that how to set the alpha. I have studied your documents about EWT.I didn't find the function of setting alpha.

mqli547798108Dear Sir

I have found my mistake, the input signal f should be a column vector. But t should be a row vector. I confused them. I can continue my work. thank you. Amazing day.

mqli547798108Jerome Gilleswhich is normal since the EWT is a data-driven approach thus if your signals are slightly different in the sense that their Fourier spectrum may contain slightly different harmonic modes hence different Fourier segments ...

Depending on what is your final goal, you analyze your signal one by one with different sets of filters (for instance plotting independent time-frequency plane) or find an "average" set of filters and then process all your signals with this unique set of filters.

Jiachen TuI mean that when params.detect is set as 'scalespace', the numbers of Fourier Spectrum segements for the same type of signal simples are different.

Jerome Gilleswhat does that mean: "are divided into different segements with scalespace function"

jackmaoEEJiachen Tu：I have the same problem with you .

Jiachen TuDear Jerome, I use EWT to analyze the vibration signal in order to extract features. But the samples, which are the same type of vibration signal, are divided into different segements with scalespace function. Could you give me some advice? Thank you very much.

jackmaoEEDear Jerome,I used your test fsig4 to Empirical wavelet transform, why did you get 26 modes instead of 6 in PDF article? Please give me some suggestion. Thank you1

Jerome GillesDear Ostnie, did you read the paper?

The purpose of the EWT is basically the same as the HHT. The intent of the EWT is to provide a technique based on the mathematical formalism of wavelet in opposition of the HHT which lacks of mathematical theory.

OstnieDear Jerome,I'm doing research on feature extraction of communication source signals, I don't not know much about EWT before, but I have learning something about HHT, What is the difference between EWT and HHT, especially in their purpose. Thankyou very much!

Dildar Ahmed Saqibthanks sir for your time... I have already got the toolbox and also have set the path as you quoted. After couple of practices em now performing the given commands on matlab.

Jerome GillesIt is mentioned in the README.txt file in the root directory...

Regarding how to set paths in Matlab, I'm sorry but I don't have the time to provide Matlab support. Find someone around you to know how to use Matlab.

Dildar Ahmed SaqibThis is dildar. Kindly sir elaborate where to add the particular folder and which documentation file says this

Jerome Gillesyou have to add the EWT folders in the Matlab paths, see the Matlab documentation ...

Dildar Ahmed Saqibyes sir it says like undefined function or variable... even the 'doc' panel does not understand the tern EWT or empirical wavelet transform.

Jerome GillesSorry but I don't have the 2012 version so I can't try myself ...

Do you get any error message?

Dildar Ahmed SaqibDear Sir,

I wanted to know that whether the version that has been uploaded on mathworks website is able to run in 2012 version of Matlab. I am trying to run some files i obtained from the site. But no file is running..

Jerome Gillesas written just before your comment: check the Test folder and read the documentation...

fei liuDear Jerome, I come from chinese students and I don't know how to use EWT code ,where are main function? there are a lot of folder, I want to use wind turbine rolling bearing fault signal and make diagnose, I don't that makes my data pour into the code ,hoping give me some advise. and I will very appreciate .my English is very poor ,please forgive me .

Jerome Gillescheck the Test folder and read the documentation.

mohanad AL-musaylhHello Jerome

Thank you so much. I want to try EWT with my project. Could you please help me to use it to decompose my data?. I want to do a paper on data forecasting.

langyaMuhammad Tariq SadiqThank you very much Jerome for very useful information

Jerome GillesI would say that in terms of extracted information, EWT and VMD will provide something equivalent. Now VMD assumes that the signal spectrum can be modeled as a mixture of Gaussians which of course is far from being the case in complex signals. Another advantage of the EWT is that it automatically finds the number of modes (assuming you used the scale-space option in the boundary detection step) while VMD expect that you manually provide this number of modes.

Muhammad Tariq SadiqDear Jerome, Thank you for your prompt feedback. Actually I am very impressed with your work. I have already implemented my research work by using EWT and got very good efficiency for my problems. Actually last week I came across with another signal decomposition method named as variational mode decomposition . This method claimed that it is better than EWT. Now I have to present my work in front of huge audience, If someone will ask why you use EWT, Why you do not use Variational Mode Decomposition method. I do not know how to answer questions like these. I would appreciate if you can give any strong justification of using EWT, instead of using any other signal decomposition method

Many Thanks

Jerome GillesDear Muhammad, in my paper I compared the EWT with the EMD but as far as I know there is no paper doing a full comparison of all data-driven methods. Regarding the EWT, my purpose was to propose an alternative to the EMD such that we can use the wavelet formalism since one drawback of EMD is the lack of theory.

If you are willing to do such comparison paper, I think it will be interesting for the community.

Muhammad Tariq SadiqDear Jerome, Can you please explain me how your method is better then EMD or any other data driven methods? I am looking forward to find comparative study on data driven methods, their pros and cons, but unfortunately i didnt find any article on it yet

Jerome GillesDear IIXSS, sorry it is a mistake on the webpage, the current version is indeed the 3.2 version, not 3.4. So you have the latest version ;-)

IIXSSDear Jerome, I downloaded your matlab code about EWT in this webpage and the version is V 3.2. But the newest version is 3.4. I wonder where I can obtain the V 3.4. Thank you.

Haris HussainHey Jerome! Hope you are doing well. Its a fantastic toolbox, thumbs up for your work. I am having a trouble when i fix the number of modes, say N=10. I get an error while using this function " Hilb=EWT InstantaneousComponents(ewt,boundaries) " :

??? Error using ==> vertcat

CAT arguments dimensions are not consistent.

Error in ==> EWT_InstantaneousComponents at 30

boundaries=[0 ; boundaries ; pi];

Error in ==> testingforloop at 35

Hilb1=EWT_InstantaneousComponents(ewt,boundaries);

Hope u understood the problem and can guide me well. Thanks in advance.

Muhammad Tariq SadiqDear Jerome, Thank you very much for valuable suggestions. One more question, X-axis and Y-axis of modes represents what information? X-axis is time axis? For every mode my x-axis showing scale like (0, 0.1,0.2,0.3.....1). And Y-axis showing amplitude?

Jerome GillesDear Muhammad, I'm guessing you are using the full automatic method using the scale-space option? Then you may use another method (like the localmaxmin option) where you can give the maximal number of expected modes.

If you want stick with the full automatic method and then at the end keep only N modes, well it is up to you to define a selection criteria ...

Basically, the IMF and MODE are the same thing.

Muhammad Tariq SadiqDear Jerome, I am using EWT for Multi-channel EEG Signals. The problem is that, for every single channel I am getting many modes like around 29 to 30 modes for each channel. I want to use 8 to 10 modes for my experiment and want to extract some features from that modes. Can you please suggest me on which basis should I select 8 to 10 modes?

Another question, can you please tell me what is the difference between IMF and MODE?

Jerome GillesDear Mayakesu,

1) I have no idea, I didn't myself investigated the use of EWT for denoising purposes...

2) I can't say specifically for denoising but the aim of the EWT is to extract harmonic modes (i.e oscillating modes). For instance textures are particularly good targets for the EWT.

3) well ... yes, the E in EWT is for Empirical, meaning that the construction of the wavelets depends on the input signal/image. You should read the papers ...

mayakesuDear Jerome Gilles, I'd like to ask you some questions:

1、After the empirical transformation, why are the PSNR values obtained for each image denoising different?Does this have anything to do with the image itself?

2、What features of an image are effectively denoised by empirical transformations?Is it just more effective for images that have certain features?

3、Are the image processing effects of EWT_2D_Curvlet_I and EWT_2D_Curvlet_II determined by the features of the image itself?

I am looking forward to your reply,thank you very much.

Jerome GillesDear Muhammad, nu_n is omega_n, it is a typo ;-)

DILEEP KUMARDear Gilles,iam working on a 1 dimension signal,iam getting an error

Attempt to reference field of non-structure array.

Error in EWT_Boundaries_Detect (line 72)

if params.log==1

Error in EWT1D (line 51)

boundaries = EWT_Boundaries_Detect(abs(ff(1:round(length(ff)/2))),params);

Error in den_EWT1D (line 25)

u=EWT1D(x1,1);

what is the value of params I have to keep if I have asignal which has one column having 1000 values

DILEEP KUMARDear Gilles,can Ewt transform will give better snr compared to emd

Muhammad Tariq SadiqDear Jerome, I am reading EWT paper. Can you please suggest me what information Vn is giving, used in Figure 4. on page 4001. You have used different values of Vn, vn=1, v(n+1)=2.5? What information we get from these values?

Jerome GillesDear Ahmed, if you don't give me the entire error message, I cannot guess what's happening ...

Ahmed Hassandear Jerome. i am trying to run your EWT_boundaries_detec function but compiler is indicating an error that "Error in EWT_Boundaries_Detect (line 72)

if params.log==1"

kindly guide me to remove it

Muhammad Tariq SadiqJerome GillesDear Muhammad, unfortunately such document does not exist! I'm currently working with my students on building such theory. The only papers which give you a description of the EWT are the papers cited above ...

Muhammad Tariq SadiqDear jerome, can you please provide any tutorial/ easy understanding/general theoretical formalism to build a complete theory of empirical wavelets (and frames)? Even though I have basic understanding of wavelets still I am facing difficulties to understand the theory behind EWT

Jerome GillesAre you sure you add all paths? This function is in the folder EWT/Boundaries/ check that this folder is in the Matlab paths ...

Muhammad Tariq SadiqDear Jerome Gills, I have added the path of the toolbox and all its subfolders in MATLAB. I tried to run Test_EWT1D but again i got following errors

Undefined function or variable 'EWT_Boundaries_Detect'.

Error in EWT1D (line 51)

boundaries = EWT_Boundaries_Detect(abs(ff(1:round(length(ff)/2))),params);

Error in Test_EWT1D (line 92)

[ewt,mfb,boundaries]=EWT1D(f,params);

Please guide me how to resolve these issues

Jerome GillesI'm not sure to understand, are you saying that you get that infinite loop only when you set params.log=1?

Otherwise, are you saying that the line ff=ff(f) gives you an error? If it is the case, the problem might be your signal because the fft function is a Matlab builtin function...

rama krishnacan any one please suggest me with the error i posted .

rama krishnaDear Gilles, i tried using EWT_1D, but when ever the file starts running after giving the inputs (f,params) .. it starts moving in to an infinite loop and also it is showing an error in the fourier domain in EWT_1D at " ff=fft(f)" .

2. i am trying to give the input of params as params.log=1.

so can you please help me to solve this problem.

Jerome Gillesyou have to add the path of the toolbox and all its subfolders in Matlab, see the Matlab documentation on how to do that...

Muhammad Tariq SadiqDear Jerome Gills, I tried to run Test_EWT1D but i got the following errors

>> Test_EWT1D

Undefined function or variable 'EWT1D'.

Error in Test_EWT1D (line 92)

[ewt,mfb,boundaries]=EWT1D(f,params);

Please help me how to resolve this error.

Jerome GillesDear Mayakesu,

1) I used the term "empirical" because it is indeed an alternative of the EMD technique.

2) so far the above mentioned papers are the only one we published. We can currently working on defining a general theoretical formalism to build a complete theory of empirical wavelets (and frames). Hopefully, we will submit a paper soon ;-)

mayakesuDear Jerome Gilles,by reading the relevant literature and running the test programs,I seem to understand my question on the coefficients , I would also like to ask you another questions, 1,why the empirical wavelet transform is called the empirical of it, does it has a great relationship with the empirical mode decomposition?

2, the theoretical knowledge of the image processing of empirical wavelet transform, in addition to the paper mentioned, can you help me recommend some of this literature?

Thanks very much.

Jerome GillesDear Jasen,

2) The mfb variable contains the filters in the FOURIER domain (as written in the documentation).

1) you don't the correct reconstruction when you try the provided signals? I mean the example in the Test_EWT1D.m file? That's strange because everything work well for me ...

Jasen SzeHi Jerome Gilles,

I know EWT a few days ago, amazing work.

I have some questions to ask.1,In the newest toolbox(1D), I can't get the right restructed signal,It seems taht the filter didn't work; 2,I saw the codes and I'm confused that the 'mbf' was in time domain,but 'ewt' was in Fourier domain, and emperical wavelets is the inner product of two, is it right?

zijian qiaoJerome GillesHi Mayakesu, the answer to which output variables contains the wavelet coefficients is in the documentation (see the pdf document in the documentation folder)...

Regarding your question "what is the difference from the processing of the wavelet coefficients?", I'm not sure to understand the question ... do you mean to what correspond the different transform? If it is the question then you need to read the corresponding papers ...

mayakesuDear Jerome Gilles;

Hello! I want to deal with the image by transforming the coefficients.Like [ewtLP,mfb,boundaries]=EWT2D_LittlewoodPaley(f,params)、[ewtc,mfb,Bw,Bt]=EWT2D_Curvelet(f,params);

Which output parameters can reflect the transform coefficients (including the detail coefficient and the approximate coefficient)?how to use them, and what is the difference from the processing of the wavelet coefficients? These questions have bothered me for a long time，and thank you very much for being able to answer these questions in your busy schedule. I am looking forward to your reply,thank you.

na zhangJerome GillesHi Hesam,

You didn't pass the right variable to the function!

In your case you must call

[ewt,mfb,boundaries]=EWT1D(signal',params);

instead of

[ewt,mfb,boundaries]=EWT1D(f,params);

hesam akbarihesam akbariHi dear Jerome Gilles;

I want to Change EWT1D cods to my noisy signal,

To this work ,i write :

Fs = 10000;

f = 1000;

n= [0:1/Fs:15];

x=sin(2*pi*f*n);

y=awgn(x,30);

signal = y;

params.SamplingRate = 10000;

params.globtrend = 'none';

params.degree=6;

params.reg = 'gaussian';

params.lengthFilter = 10;

params.sigmaFilter = 1.5;

params.detect = 'scalespace';

params.typeDetect='otsu';

params.N = 10;

params.completion = 0;

params.InitBounds = [8 50];

params.log=0;

[ewt,mfb,boundaries]=EWT1D(f,params);

And my error is:

Attempted to access boundaries(0); index must be a positive integer

or logical.

Error in EWT_Meyer_FilterBank (line 35)

r=(pi-boundaries(Npic))/(pi+boundaries(Npic));

Error in EWT1D (line 61)

mfb=EWT_Meyer_FilterBank(boundaries,length(ff));

Error in Untitled (line 60)

[ewt,mfb,boundaries]=EWT1D(f,params);

I think that this error comes from choosing the "params.InitBounds = [8 50]",

Please help me to choosing correct boundaries ,thanks.

Excuse me for my poor grammar.

bing wangJerome GillesHi all, good news!

A priori I fixed all bugs, so please update your version!

Let me know if you still have some issues and thanks for those of you who reported the problem!

Jerome GillesDear, it turns out that a bug related the new part of the code is present in this version. It didn't showed up in the test I ran before updating the toolbox but some of you as well as some of my students reported me that bug.

I'm currently working to fix it. Then if you don't need the toolbox quickly, I'll suggest that you wait for the next update (hopefully within a few days).

If you need a working toolbox, feel free to contact me to get the previous version.

Chammy Wangwhen i use another boundary detection method ,the EWT_TF_Plan doesn't work.

Error using vertcat

Dimensions of matrices being concatenated are not consistent.

Chammy WangBEYONDsir i am getting the below response:

1.Error using zeros-Out of memory. Type HELP MEMORY for your options.

2.Undefined function or variable 'instfreq'.

Jerome GillesMani,

when you said "large data", what size are you talking about?

How many samples and encoded in which format?

I'm afraid that the issue is that your computer has not enough memory to support these calculations ... btw, are you using the scale-space method?

manisir i am getting the below response,

"Out of memory. Type HELP MEMORY for your options."

Jerome GillesDear Mani,

What is the error message??

manisir i am getting a memory error for large data. can u suggest anything.

Jerome GillesDear Chhatramani Singh,

The answer is no for two main reasons:

-I don't have the time

-I don't know python

But I would more than interested to have a python version of that toolbox ;-)

chhatramani singhand sir i have another question for you are you planning to implement this in python also

Jerome GillesIf you use another boundary detection method than the scale-space one, you will be able to fix the number of modes you want (see the documentation PDF).

sumitdear sir,

i am working on speech signal for denoising, after adding noise every time ewt gives variable different imf(component). for my work i want fix number of imf so what should i do to get it.

sumitsir, can you tell me what code should i use for calculation of am fm bandwidth component of ewt.

Jerome GillesDear Sumit,

A priori, the EWT gives the same type of components as the EMD, so yes you should be able to compute the same "bandwidths" as it is done with the EMD ;-)

sumitsir,

AM -amplitude modulation bandwidth and FM- frequency modulation bandwidth components .which we get by decompose the eeg signal by EMD method . can we get these component by EWT also?

Di XuJerome GillesDear Sumit,

Well, what are your definitions of AM,FM bandwidths?

Yao RuiQirun TEST_EWT1D.m

error:The variable ewt in a parfor cannot be classified

error in:

parfor k=1:length(mfb)

ewt{k}=real(ifft(conj(mfb{k}).*ff));

ewt{k}=ewt{k}(l:end-l);

end

sumitsir, i am using function

Hilb=EWT_InstantaneousComponents(ewt,boundaries)

so i get the amplitude envelop and instantanious frequency figures of imfs . now i want to calculate the AM and FM bandwidth of the signal what should i do...

Jerome Gilleswell the code to perform that transform is available here ... click the "Download Zip" button on top right of this page ...

satyavijay tiwarii want to use this transform in detection of epileptic seizure in eeg signal .so can you provide the required coding

my email add - satyavijaytiwari@gmail.com

satyavijay tiwarithank you sir,

I will look in to it...

Jerome GillesDear Satyavijay,

I don't have that version of Matlab so I can't try myself but since that toolbox does not use any "funky" toolboxes, I would say that it will probably work in Matlab 2013 ;-)

satyavijay tiwaridoes it work matlab 2013

satyavijay tiwariJerome GillesNew version available!

It fixes some bugs in the curvelet transform and proposes the curvelet option 3

Jerome GillesDear Trunal,

The purpose of the EWT is to extract the different harmonic modes from your input signal.

What you will do with these modes is completely up to you. For instance, in some fields, people look at the time-frequency plots to find useful information. In denoising, people "clean" the wavelet coefficients (harmonic modes here) and then reconstruct the denoised signal,...

Again, it depends on your final goal. I understand you want to find some parameters,... does it mean that you have a model predicting the different modes and you want to fit this model (i.e find its parameters) to your data?

In general, I would suggest you read the (extensive) literature on wavelets and their use in applications.

trunal jambholkarthanx for rlpy ,

sir I want to know about modes and boundaries, and how they formed, at what parameter they depends.

Jerome GillesDear Trunal,

Thanks for using this toolbox!

It is difficult to reply to your question as it depends on what is your final goal ...

trunal jambholkarsir I am doing work on ECG feature extraction, for extraction what is next step after mode (using Test_EWT1D) selection. plz sir help me out.

Jerome GillesDear all,

I just uploaded a brand new 2.0 version of this toolbox!

Bugs fixes + many new functions available.

As usual do not hesitate to give me your feedback ;-)

NidhinDear Jerome,

My email-id is nidhin89@gmail.com.

Thankyou for the reply. :D

Looking forward for the new version. ;)

Nidhin

Jerome GillesHi Nidhin

Can you send me an email and I will send you the missing file.

Btw, I plan to release a new version of this toolbox very soon with some new cool features ;-)

Jerome

NidhinHi Jerome

When I tried to run the code 'Test_EWT2D_LP.m',the following error is shown:

??? Undefined function or method 'Show_EWT2D' for input

arguments of type 'cell'.

I searched for the function Show_EWT2D in the folders but couldn't find.

Pls help

Thanku for the help regarding ftc_seg mex compilation :D

Nidhin

santhoshszDear sir, Out of your toolbox which is best suitable for extracting feature in an image.

Jerome GillesWhat is spikelet?

AneeshHow can i use spikelet in matlab..

Jerome GillesDear Vidyasagar,

Sorry for the late answer, I was travelling a lot these last weeks!

concerning the compilation "mex ftc_seg.c", did you go on the right folder (i.e. Boundaries/FTC)?

otherwise, for the supplementary lines of code for Windows users, you should add them in the file ftc_seg.c itself.

let me know if this help ;-)

Jerome

vidyasagar khello Jerome. thankyou very much for the tool box.

iam trying to compile under windows, iam getting an error.

>> mex ftc_seg.c

C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: 'ftc_seg.c' not found.

??? Error using ==> mex at 222

Unable to complete successfully.

can you please suggest me the solution. where should i add the bellow mentioned code?

double round(double val)

{

return floor(val + 0.5);

}

i mean which part of ftc_seg.c

please help.

thankyou very much.

Jerome GillesFor people trying to compile ftc_seg.c under Windows, you should add the following lines in the C file if you get some linking error:

double round(double val)

{

return floor(val + 0.5);

}