How to adjust the length of each cell array in a nested cell array for SWT Denoising?

3 views (last 30 days)
Hi all,
I have a nested cell array c (12600,1). Each cell array contains time series with varying length. I want to denoise each of these time series using a db-10 wavelet with 8 levels of decomposition using SWT denoising-1D in the Wavelet Analyzer toolbox.
SWT denoising requires that for 8 levels of decomposition, the length of the input time series should be a multiple of 2^8 (i.e 256). That is, the length of my time series should be multiples of 256 ( 256, 512,768 etc...). So for all the cell arrays, I want to alter the length of the time series to be muliples of 256 by removing some data points in the time series. For ex: if the length of time series is 6000x1, I want to make it to 5888x1 by removing data points and I want to do this for all cell arrays in the nested cell array.
How do I do this?
Thanks,
P.S: I tried using the signal extension toolbox for this case, but the additional data points added to the time series altered my analysis results. Hence I rather remove data points from my time series (shorten) than add additional artificial data points (extend) to the length of time series.
Capture.PNG

Accepted Answer

Star Strider
Star Strider on 28 Jul 2019
I am not certain how you are doing the denoising. However getting the vectors to the appropriate lengths is straightforward.
Example:
V = rand(5998,1); % Create Vector
ExtraLength = rem(numel(V), 256); % Length Beyond Integer Multiples Of 256
V1 = V(1 : numel(V)-ExtraLength); % First Vector For Denoising
V2 = V(ExtraLength+1 : end); % Second Vector For Denoising
This will ‘trim’ ‘V’, the first (‘V1’) removing elements from the end, the second (‘V2’) from the beginning. Ideally, you can denoise your entire signal by denoising both, then recombine (concatenate) the end of the second with the first to have a denoised version of the entire signal:
DV1 = ... ; % Denoised ‘V1’
DV2 = ... ; % Denoised ‘V1’
DV = [DV1, DV2(numel(V2)-ExtraLength+1 : end)]; % Denoised Vector
If I remember correctly, the denoised vectors are row vectors (not column vectors as were your original vectors), so be careful in creating ‘DV’ to concatenate them correctly.
I tested parts of this but not all of it, so I am presenting this as UNTESTED CODE.
  10 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!