File Exchange

image thumbnail

Feature Extraction Using Multisignal Wavelet Transform Decomposition

version (2.77 KB) by Rami Khushaba
Feature extraction using the wavelet transform.


Updated 11 Feb 2013

View License

I am simply extracting three types of features from the wavelet transform coefficients, these include: energy, variance and waveform length. You can modify and extract any types of features as you need.

** You need the wavelet toolbox to run this code.

Comments and Ratings (23)

As Has

sir , please you said that you have extracted tree types of features stored in the variable feat which gave me 29*44 ?? where is the statically measure energy , mean and variance


Didik, your comment relates to another submission, not this one!!!

You are referring to the wavelet packet feature extraction. In that submission there is an attached pdf tutorial. The answer to your question is: look at the tree and decompose to 7 levels as per the example and count how many nodes in your resulting tree, they would be 1+2+4+8+16+32+64+128=255.

Anyone, please tell me how we should set the winsize and wininc corrrectly? Then, in the readme line 39-40 : "Total = 255 features
% and the result from the example above is feat is of size 25 x 255". I just don't get it, how it obtain 25 x 255? Thanks

ahmed silik

thank you very much

ahmad sh

thank you very good

ahmad sh


dear sir,please suggest me an approach to recognize isolated words . ive extracted the features of different words using ur 'oh so awesm' code. 100 thanka for that



Hi Dr

I am so interesting to know if we have discrete impulse response signals. is it possible use your code to extract features from mentioned signals?

Thanks Yousra,

The answer to your question is in the comment "right below your question", please READ the comments.

Thank you Dr.
How i can use it with image 2D

Dear Hamed abdulaziz & Prabhakar

Thank you for your inquiries. I work mainly in signal feature extraction, rather than image feature extraction. My Suggestions for you could be:
1- Reshape each image into vector and apply this code on each vector.
2- OR, use the 2D wavelet decomposition commands (more suitable for images) and extract your features from each node in the same way am doing here. Note with the 2D version, you will have a small image at each node and you can use something like moment invariants to get the features from each image. Look here (


Dear Dr. Rami.Khushaba,

please How to use this method to extract the features from image.

I'll wait for your answer impatiently.


Dear Dr. Khushaba,

How to use this method to extract the features for image

Dear Shiddiq Hashuro

I believe that you are completely confusing between the number of samples (1024 in the previous example) and the number of features (44 in the previous example). You only have 44 features and not 1276 as you described (that's wrong).

I am thinking of posting a video to explain this, stay tuned to my website (


Dear Dr. Khushaba,

thank you for the reply. It helps me a lot.
I have more questions now if you don't mind. My plan of using feature extractor is to reduce the dimension, but for example in this case,the previous dimension was, say, 1024 and after, it became 44x29 which is 1276, it got larger. I guess we're supposed to select the important features,is it correct? You would help me a lot if you can give me directions as where to start with this,is there some kind of correlation check you think i can do?

thank you very much for your time.

Dear Shiddiq Hashuro

Thank you for your inquiry. At the moment the code works on single dimensions, i.e., vectors. If you need to run this code on multiple dimensions then just use a for loop and repeat it for each dimension. I will soon update the code to account for that as I have fixed this issue with the wavelet packet code as well.

On the other hand, you are right about the 29x44 features. For 10 levels you should get 11 features as we have decided to extract 4 types of features then we get 11 x 4 =44. As for the 29, since we are using an overlapping windowing scheme then the total 1024 is divided into windows of 128 samples slided by 32 samples giving you a total of 29 window each having 44 features.

Hope that helps. Let me know if you have further inquiries.


Dear Dr. Khushaba,
thank you for the share..
i tried using more than one column of input data but it gave me this error on line 61 %feat(1:winsize,i) = detrend(curwin);% : ??? Subscripted assignment dimension mismatch.
i suspect this is because feat(1:winsize,i) is (winsize by 1) in size and the result's size of the detrend,which is the same as curwin's size is (winsize by number_of_column)..
i might be able to repair this line but i wouldn't know about the next lines,so i might need your help.. however,this might possibly be an error on my side,in any case please comment..

also,can you explain about the result matrix,the result dimension for an input like your example %rand(1024,1)% is (29 by 44) instead of (1 by 44),is this normal?

thank you anyway,you've already helped me.



Entropy feature added.

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux