I'm trying to apply a DWT with 3 composition levels and the following question arose when calculating the composition matrix. The step I'm trying to follow is:
The DWT coefficientes are obtained from filtering operations and are divided in approximation ($cA$) and detail coefficients ($cD$).
Three Decomposition Level of DWT
If a signal $f(n)$ is scaled up to a defined decomposition level, then, it will be producing a wavelet matrix $M(J+1,n)$, this matrix is analysed using its correlation matrix defined by:
$$ \boldsymbol{Y}=\frac{\boldsymbol{M} \times \boldsymbol{M}^T}{n} $$
where $n$ is the total sample numbers. Therefore, it has a matrix $Y(J+1,J+1)$ which contains the scaled frequency information of the signal.
Each level of decomposition will have a matrix with a different size, so how am I going to analyze the correlation matrix? Should it be done individually? Should I complete with zeros? Should I only analyze $cD_3$ AND $cA_3$?
For example, for a discrete signal that I am applying dwt MATLAB toolbox. It will first generate a $cD_1$ (9x1), $cD_2$ (6x1), $cD_3$ (4x1) and $cA_3$ (4x1).
Each coefficient has a different size.
Reference Algorithm for transformer differential protection based on wavelet correlation modes
MATLAB CODE:
for i = 1:num_windows
current_start_index = start_index + (i - 1) * step_size;
current_end_index = current_start_index + half_cycle_samples - 1;
windowed_Ida(:, i) = Ida_n(current_start_index:current_end_index);
windowed_Idb(:, i) = Idb_n(current_start_index:current_end_index);
windowed_Idc(:, i) = Idc_n(current_start_index:current_end_index);
swc_a = swt(windowed_Ida(:, i),3,"db4");
n_a = length(swc_a);
Y1 = (swc_a * swc_a') / n_a;
swc_b = swt(windowed_Idb(:, i),3,"db4");
n_b = length(swc_b);
Y2 = (swc_b * swc_b') / n_a;
swc_c = swt(windowed_Idc(:, i),3,"db4");
n_c = length(swc_c);
Y3 = (swc_b * swc_b') / n_a;
YT = (Y1 + Y2 + Y3)/3;
D = eig(YT);
MCW(start_index + (i - 1) * step_size : start_index + (i - 1) * step_size + half_cycle_samples - 1) = max(D);
end