What is the difference between 'wavedec' and 'dwt' in matlab? - matlab

What is the difference between 'wavedec' and 'dwt' in Matlab?
Which command should be used to decompose a signal?

The difference is single level and multi-level decomposition of the signal.
dwt can be used for just applying wavelet transform to a signal. But, in images where you are trying to extract information, I have seen mostly multi-level decomposition is preferred.

Related

feature extraction for machine learning

Looking for some advice. I am playing around with an accelerometer, combined with the machine learning app in matlab. Clearly there are many ways to extract features from the received data, both in time and frequency domains. However, I have recently come across time-frequency analysis, specifically using wavelets.
Has anyone got any advice on using wavelet analysis for classifying accelerometer (or similar) data and the benefits of using it ? Or if indeed this would be a valid way of extracting features ? I'm not too sure what sort of data I should be extracting using this method ?
Thanks in advance.
Few points to note,
1)You can transform a number of samples (should be a dyadic number and depends on your sampling frequency) into wavelet domain and classify that data. (eg. if you transform 64 accelerometer samples then you also have 64 points in wavelet domain).
2) Apart from time-frequency information from wavelet transformation, wavelet transformation has sparsity property
(https://en.wikipedia.org/wiki/Sparse_approximation) that would be useful for your classification model.
3) Also, you can try different wavelet basis functions (mother wavelets),
and try to figure out which basis is most suitable for your data. Maybe you can start with Haar basis function as it is more suitable to capture the singular behaviour of your data.

Statistical features of wavelet transform

Please could anyone explain what is meant by the following, and how I can find this using MATLAB? Any help would be appreciated.
Statistical features of wavelet transform
Statistical features can be any statistical value like mean, entropy, power, power over frequency band. This statement means using a wavelet transform calculate statistical feature of signal.
An example of it would be like generating a wavelet transform for transient detection. Now transient is a jump in signal it can be from custom statistical feature like change_in_amplitude/change_in_frequency.

Implemeting low-pass Daubechies wavelet filters in matlab

I have been trying to implement these two filters in MATLAB:
Daubechies 4 undecimated wavelet 3.75 Hz e wavelet 7.5Hz
Daubechies 4 undecimated filter bank 7.5 Hz
I have massively researched the wavelet toolbox and I still can't figure out what is the correct implementation of the algorithm, as well as the definition of the cut-off frequencies.
Does someone have experience with this?
What I tried was:
movementOut = movementIn;
% Set Daubechies wavelet name.
wname = strcat('db',num2str(order));
% Compute the corresponding scaling filter.
daubechies=dbwavf(wname);
movementOut = filter(daubechies,1,coordinates_values);
%movementOut = filtfilt(daubechies,1,coordinates_values);
I tried both filter and filtfilt but the output result seems pretty much similar. I am processing Kinect Z data (varying from 4.5m to 1.0m and then again to 4.5m) but I don't seem to see any difference using wavelets. In state-of-art approaches, the db4 wavelets are being often used.
Doubts:
is this implementation correct?
how can I set the cut-off frequency?
how to implement the filter bank?
Thanks in advance.
It's not super clear to me what you want to do but you need to use wavelet filters in wavelet algorithms. Do you have the wavelet toolbox? It has good documentation!
Wavelet transforms do band-pass filtering, so you may want to use another algorithm for your purpose. To see what would be 3.75 Hz or 7.50 Hz in your signal, you can compute the upper and lower bounds, if you know the sampling rate of your input.
Have a look at this post, which provides some links to matlab scripts for fast wavelet transforms (a sequence of filtering and up-/downsampling combinations) you can use if you don't have the wavelet toolbox.
Mind you, the fast wavelet transform does use downsampling so it is not 'undecimated'. There are a number of ways to do that, in the wavelet toolbox, in WaveLab and other places (see this paper for an overview). Some more reading may be a good idea, the references in that paper should do the trick.
One final warning: the name db4 is sometimes used for the filters with 4 coefficients (2 vanishing moments), and sometimes for the filters with 4 vanishing moments (8 coefficients)! Google "Daubechies 4" and you'll find both.

Frequency representation using discrete wavelet transformation

I am trying to use wavelet transform to represent song in frequency domain using discrete wavelet transform to made decomposition and made the frequency of the singer in place the the song using Matlab
The problem that the dwt and the decomposition mades represent it only in time domain.
How can I represent it in frequency if DWT doesn't represent It what would do?
Thank you
When we say "frequency transform" or talk about "representing frequency" we are usually talking about the Fourier Transform, implemented as the DFT, or discrete Fourier transform. Andre is correct in the comments below when he says that the DWT is also a type of frequency transform; however, wen we say "represent song in frequency domain" it usually means DFT, not DWT.
That being said, I don't recommend the DWT for music and sound analysis because the analysis bands are fixed at one-octave, which is simply too wide to do anything meaningful with. There are other techniques related to wavelets that are more effective for audio, but I don't gather from your question that you are using one of them.
In addition to the DFT, which is usually implemented as the FFT, or fast Fourier transform, you may also want to read about the STFT (short-time Fourier transform).

Power spectrum from autocorrelation function with MATLAB

I have some dynamic light scattering data. The machine pumps out the autocorrelation function, and a count-rate.
I can do a simple fit to the ACF
ACF = exp(-D*q^2*t)
and obtain the diffusion coefficient.
I want to obtain the same D from the power spectrum. I have been able to create a power spectrum in two ways -- from the Fourier transform of the ACF, and from the count rate. Both agree, but the power spectrum does not look like in the one in the books, so I'm not sure how to use it to work out the line width.
Attached is an image from a PDF that shows what you should get, and what I get from MATLAB. Can anyone make sense of whats going on?
I have used the code of answer #3 on this question. The resulting autocorrelation comes out exactly the same as
the machine gives me and
using MATLAB's autocorr command on the photoncount data.
Thank you for your time.
When you compute the Fourier transform from short sequences of data it often looks very noisy. There are a number of reasons for this. One reason is that the statistics of individual Fourier components are not Gaussian, and so averaging the spectra across multiple samples of data will only slowly improve the quality of the estimate.
Another causes of "noisiness" in empirical spectra behavior is that you are applying (to a finite data sample) a transform which involves a pathological sinc function and which assumes an infinite length signal. To diminish this problem, it helps to apply a "windowing-function" to your data before computing the Fourier transform. One of the more complicated but also more powerful windowing approaches is the use of so-called 'Slepian tapers'.
MATLAB conveniently implements well-known windows in functions such as hamming and hann.