Denoising using Wavelet problem

The inbuilt MATLAB function "wdenoise" does not output the denoised signal. I used the following syntax
f8_clean = wdenoise(f8,5,'Wavelet','db4')
where "f8" is my noisy input signal, "5" is the level of decomposition, and "db4" is the chosen wavelet. The output signal "f8_clean" is supposed to be noise free to some extent, but it exactly matches with my input signal "f8".
What am i doing wrong?

Answers (1)

Perhaps your noise is just very small and your signal is very regular? And perhaps you only checked to 4 digits?
format long g
t = linspace(0,1/100, 2500);
f8 = sin(t*2*pi*17) + randn(size(t))/100000;
f8_clean = wdenoise(f8,5,'Wavelet','db4');
[maxdiff, maxidx] = max(abs(f8-f8_clean))
maxdiff =
3.77285063186683e-05
maxidx =
996
[f8(maxidx), f8_clean(maxidx)]
ans = 1×2
0.412549466538199 0.412587195044517

4 Comments

Hi @Walter Roberson. Thanks a lot for the response.
I used the below basic code including the long format method, but it still fails to denoise my signal.
format long g
load f8.dat
f8_clean=wdenoise(f8,5,'Wavelet','db4');
On the other hand i tried using the wavelet denoiser app provided by MATLAB. I was able to denoise the signal there. I have shared a screenshot of the "denoised signal", which is labelled as approximation. Why is the code not able to do so? Whats the problem?
I am attaching a .txt file with the data i want to denoise. You can look at that. It is given at 1 sample per second.
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/890350/f8.txt';
format long g
f8 = readmatrix(filename);
f81 = wdenoise(f8,5,'Wavelet','db4');
[maxdiff, maxidx] = max(abs(f8-f81))
maxdiff =
0.00189041871851714
maxidx =
502
plot(f8, 'r-', 'DisplayName', 'f8');
hold on
plot(f81, 'k-', 'DisplayName', 'f81');
hold off
xlim([4.8e3 4.9e3])
legend show
Not the same.
plot(f81-f8, 'DisplayName', 'difference')
xlim([4.8e3 4.9e3])
legend show
I am having the same problem. I check the MSE for the denoised signal and it is on the order of 10^-26.
What shows up if you plot the difference between the original signal and the denoised signal?

Sign in to comment.

Asked:

on 9 Feb 2022

Commented:

on 10 Apr 2022

Community Treasure Hunt

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

Start Hunting!