Does signal filtering with wavelet deconstruction (wavedec) and then reconstruction (wrcoef) introduce a phase shift ?

4 views (last 30 days)
Hello
I am removing low frequency noise from a signal using wavelet deconstruction and then reconstruction at a specific level:
I am removing the approximation signal at level 10 which approximates the low frequency noise
[c,l] = wavedec(signal,14,'db2');
lfnoise = wrcoef('a',c,l,'db2',10);
final = signal - lfnoise;
Does this instroduce a phase shift in the final filtered signal? Visually it does not seem to add a significant phase shift, but wanted to know if there is a small phase shift that may be hard to detect? If so how can I quantify this phase shift?
Tx

Answers (1)

Paras Gupta
Paras Gupta on 22 Aug 2023
Greetings,
I understand that you want to quantify the phase shift between the original and the reconstructed signals. The phase shift occurs as some information may be lost during the deconstruction and reconstruction process.
Please refer the code below to quantify the phase shift:
Fs = 1000; % Sampling frequency (Hz)
t = 0:1/Fs:1; % Time vector (1 second duration)
f = 10; % Frequency of the signal (Hz)
signal = sin(2*pi*f*t);
[c,l] = wavedec(signal,14,'db2');
lfnoise = wrcoef('a',c,l,'db2',10);
final = signal - lfnoise;
% Plot the original signal and the final filtered signal
figure;
subplot(2, 1, 1);
plot(t, signal);
title('Original Signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(2, 1, 2);
plot(t, final);
title('Final Filtered Signal');
xlabel('Time (s)');
ylabel('Amplitude');
% Quantifying the Phase Shift
original_phase = angle(hilbert(signal));
filtered_phase = angle(hilbert(final));
phase_difference = filtered_phase - original_phase;
size(phase_difference)
ans = 1×2
1 1001
Please find more information on the functions used in the code above using the following documentation links.
Hope this helps.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!