Different wavelet decomposition output matlab and simulink

Hi,
I have built a code that used wavelet decomposition ('wavedec') with 3 levels and sym3 mother wavelet. When I tried to build a model in simulink using the DWT block with symlets, assymetric, and 3 levels selected, the outputs of the transformations are different.
Please help me figure out why this is or how can I make it the same.
Thank you.

4 Comments

Hi Douglas,
Can you describe in more details how the transformations are different? If you can send me some code or data to reproduce, I will be happy to investigate this further.
Prashant
Hello, Prashant.
Thank you for your response/support. I have broken my head around this, but it seems another problem is to blame. The signal that I was dealing in the editor and Matlab environment changed when importing to Simulink. I am still not sure why this is happening, I have tried many ways to import, setting up the signal as array, timeseries, what I could do, but always 500 (around) samples ended up corrupted. This only got fixed when I imported the data not with the 'from workspace' block, but with the 'from .mat file' block. The data has 840k samples. Do you know why this happens? Is this a standard issue?
Thank you again.
Hi Douglas,
Thanks for your response. I have not seen such issue in general. One of the things which I have seen happening is Simulink interpolating between time steps because MATLAB defined times are "slightly" different than Simulink ones. For example:
Consider a Simulink model with Fixed-step 0.2 secs and duration 10 secs and a signal is defined in MATLAB with time as follows:
t = (0:0.2:10)'
This is different than Simulink generated time steps in terms of precision. Simulink defines the time steps as following:
tStart = 0;
tFinal = 10;
stepSize = 0.2;
numSamples = (tFinal-tStart)/stepSize;
t = stepSize*[0:numSamples]';
If I plot the difference between these two generated time steps, you will notice some difference.
Due to this, sometimes there are issues because Simulink will interpolate data when it won't hit the time step exactly.
If you can send me some sample data, I will be happy to investigate the reasons you were seeing a difference.
Sorry about the delay. I was and still am not sure how to put it here, but the problem remains. I wavelet output still different in simulink than MATLAB, but the input signal now is the same with the 'from file' block.
Here is the code that I am using. 'i' is the numebr of windows in this example there is 1 with 40k samples. 'o' is the decomp level, in my case it is 3.
The data file and simulink are attached.
I am comparing the output in MATLAB and the one given by simulink. They are both very alike, have almost the same mean and energy, but results are different, which changes the output of my method.
[c,l] = wavedec(signals(i).voltage,n_level,'sym4');
coef=detcoef(c,l,o);

Sign in to comment.

Answers (0)

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Asked:

on 13 Oct 2017

Commented:

on 24 Oct 2017

Community Treasure Hunt

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

Start Hunting!