how to design a moving window and apply DWT on each sample?
2 views (last 30 days)
Show older comments
hi, i have 4 different DC signals and i have to apply a moving window with a width of 1024 sample data and then apply DWT on each sample to calculate details and approximation coefficients. please help.
0 Comments
Accepted Answer
Adam Danz
on 18 Aug 2018
Edited: Adam Danz
on 18 Aug 2018
Here's a template using a vector of fake data. Within the loop the window starts at the beginning of the vector and moves down one index value every iteration. The outputs are stored in a matrix where each row is the result of one window and each column is a different window. You could put all 4 DC signals within the loop and store their outputs in separate variables.
% fake data
vec = rand(1,2000);
% window size
windSz = 1024;
% Number of iterations given window size
nWindows = length(vec) - windSz + 1;
% Allocate loop variables
cA = zeros(nWindows, 515); % don't hard code this - I did it for simplicity
cD = cA;
% Loop through each window
for i = 1:nWindows
tempIdx = i:i+windSz-1;
[cA(i,:),cD(i,:)] = dwt(vec(tempIdx),'sym4');
end
7 Comments
Adam Danz
on 28 Aug 2018
Question 1) What are the values of
Ip12,Ip21,In12,In21
Could you attach them in a mat file?
Question 2) Is your moving window moving across the vector sig or are trying to perform the moving window analysis only on each of the 4 variables listed above in isolation? This is critical for me to understand before I can suggest changes.
More Answers (0)
See Also
Categories
Find more on Discrete Multiresolution Analysis 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!