Mambo
Mambo

Reputation: 111

matlab discrete wavelet transform wfastmod in wmulden

I am interested to derive the discrete wavelet transform for noise reduction of more than 50,000 data points. I am using wmulden - matlab tool for wavelet tranform. Under this function, wfastmcd, an another function is being called which takes only 50000 data points at a time. It would be highly helpful if anyone suggests how to partition the data point to get the transform of entire data set or if there is any other matlab tool available for these kind of calculations.

Upvotes: 1

Views: 184

Answers (1)

Mauker
Mauker

Reputation: 11497

I've used a for loop to solve that one.

First of all, I've calculated how many "steps" I needed to take on my signal, on a fixed size window of 50000, like:

MAX_SAMPLES = 50000;
% mySignalSize is the size of my samples vector.
steps = ceil(mySignalSize/MAX_SAMPLES);

After that, I've applied the wmulden function "steps" times, checking every time if my step is not larger than the original signal vector size, like the following:

% Wavelet fields
level = 5;
wname = 'sym4';
tptr  = 'sqtwolog';
sorh  = 's';

npc_app = 'heur';
npc_fin = 'heur';

den_signal = zeros(mySignalSize,1);

for i=1:steps

    if (i*MAX_SAMPLES) <= mySignalSize
       x_den = wmulden(originalSignal( (((i-1) * MAX_SAMPLES) + 1) : (i*MAX_SAMPLES) ), level, wname, npc_app, npc_fin, tptr, sorh);
       den_signal((((i-1) * MAX_SAMPLES) + 1):i*MAX_SAMPLES) = x_den;
    else
        old_step = (((i-1) * MAX_SAMPLES) + 1);
        new_step = mySignalSize - old_step;
        last_step = old_step + new_step;
        x_den = wmulden(originalSignal( (((i-1) * MAX_SAMPLES) + 1) : last_step ), level, wname, npc_app, npc_fin, tptr, sorh);
        den_signal((((i-1) * MAX_SAMPLES) + 1):last_step) = x_den;
    end
end

That should do the trick.

Upvotes: 1

Related Questions