-2

let us consider following code

>> fs=100;
>> N=1000;
>> t=0:1/fs:N-1;
>> y=10*sin(2*pi*100*t)+0.5*randn(size(t));
>> plot(y)
>> plot(t,y)
>> 

enter image description here

i have applied following threshold methods thr = 0.4;

% Perform hard thresholding. ythard = wthresh(y,'h',thr);

enter image description here

enter image description here

but i can't see any difference,also soft threshold method,codes are there

ythard = wthresh(y,'h',thr);
>> plot(ythard)
>> ytsoft = wthresh(y,'s',thr);
>> plot(ytsoft)

so what is wrong?also i have done thresholding time time domain without calculation wavelet coefficients,are they equal to each other?i meant if i will generate wavelet coefficients and threshold this coefficient,will they give me same result?thanks in advance

1 Answers1

4

The wthresh function will set all values below the threshold to zero. It looks like most of your signal is above 0.4 so it doesn't have much effect. This is what it looks like with a (hard) threshold of 1.3:

enter image description here

The wavelet transform is similar to a windowed fourier transform. It breaks an incoming signal into sub-signals which are basically representations of different frequency components of the original. The advantage is that it keeps time based information, and is adaptive to the data. These sub-signals can then be thresholded and put back together to get frequency targeted de-noising of the original (as opposed to thresholding based on magnitude). So, to answer your question, no they won't be the same.

It's a pretty big topic, and it can take a bit of time to wrap your head around it. I recommend starting here to understand the wavelets part and here for a primer on wavelets in Matlab. Here is a great write-up on just de-noising, but I HIGHLY recommend getting a good grounding in the theory first.

Wavelet de-noising can be pretty finicky, and has lots of parameters to experiment with. For example, which wavelet to use, which thresholding strategy to use, how many levels to decompose to etc. Basically you'll need to play with it a lot.

The easiest way to implement it quickly is using wden. Here's an example lifted from the docs:

% Set signal to noise ratio and set rand seed. 
snr = 3; init = 2055615866; 

% Generate original signal and a noisy version adding 
% a standard Gaussian white noise. 
[xref, x] = wnoise(3, 11, snr, init);

% De-noise noisy signal using soft heuristic SURE thresholding 
% and scaled noise option, on detail coefficients obtained 
% from the decomposition of x, at level 5 by sym8 wavelet. 
lev = 5;
xd = wden(x, 'heursure', 's', 'one', lev, 'sym8');

% Plot signals. 
subplot(611), plot(xref), axis([1 2048 -10 10]); 
title('Original signal'); 
subplot(612), plot(x), axis([1 2048 -10 10]); 
title(['Noisy signal - Signal to noise ratio = ',... 
num2str(fix(snr))]); 
subplot(613), plot(xd), axis([1 2048 -10 10]); 
title('De-noised signal - heuristic SURE');

Results:

enter image description here

Pokey McPokerson
  • 752
  • 6
  • 17