# Understanding noise removal method using wavelets

I am trying to understand how wavelet transform can be used to denoise a time series or signal and how to plot the scalogram image. My signal has a lot of fluctuations and as such I am finding it difficult to denoise. Morevoer, to plot the scalogram I need to know the frequency. I don't know what is the frequency for this particular kind of time series obtained from a dynamical system of the form: Logistic Map given by: $$x[n] = 4\big(x[n-1]\big)\big(1-x[n-1]\big)$$ Systems similar to this type of dynamical systems are the Lorenz, Mackey-Glass. Can somebody please help:

1. How to properly denoise the signal? As observed, from the plot the denoised signal denoised does not look exactly the same as the clean signal x (black dotted line), so what are other parameters or wavelet types that I could use and how to decide which ones to use. Is there a rule of thumb?

2. What is the sampling and nyquist frequency for this kind of signal and

3. how to plot the scalogram image: I used wt() to obtain the wavelet coefficients. After that how to plot the image of scalogram so that X axis is time and Y axis is Frequency?

 x(1) = 0.1; % initial condition (can be anything from 0 to 1)
M = 50; %number of data points (length of the time series)
for n = 2:M, % iterate
x(n) = 4*x(n-1)*(1-x(n-1));
end

x_noise = awgn(x,10,'measured');

%denoise using wavelet
denoised = wdenoise(x_noise, 3,'Wavelet','db3',...
'DenoisingMethod','Bayes',...
'ThresholdRule','Median',...
'NoiseEstimate','LevelIndependent');
figure
plot(x_noise)
axis tight
hold on
plot(denoised,'r')

fb = cwtfilterbank('SignalLength',M);
[cfs,frq] = wt(fb,denoised);


Your signal (with initial par x0 =0.1) is already noise like and high frequency. It will be hard to distinguish it from the added white noise... One thing you can do is to interpolate (resample) the time series by a large enough factor and then later add the white noise. This will artifically help to separate the noise spectrum and your signal spectrum but the signal lengths will also be increased. whether it is what you have to do is up to you !

The following modification apparently improves the noise removal, but fundamentlaly it's separating the noise spectrum from the signal. So whether this is a viable option is upto your applications:

 M = 50;        % number of data points (length of the time series)

x(1) = 0.5;    % initial condition (can be anything from 0 to 1)
for n = 2:M,   % iterate
x(n) = 4*x(n-1)*(1-x(n-1));
end

U = 10;       % interpolation factor
xU = resample(x,U,1);  % just interpolate the obtained sequence

% add noise onto the interpolated sequence xU
x_noise = awgn(xU , 10 , 'measured');

%denoise using wavelet
denoised = wdenoise(x_noise, 3,'Wavelet','db3',...
'DenoisingMethod','Bayes',...
'ThresholdRule','Median',...
'NoiseEstimate','LevelIndependent');

denoised = resample(denoised,1,U);   % downsample de-noised sequence back

figure
plot(x_noise(1:10:end))   % down-sample noisy seqeunce on the fly for displaying
axis tight
hold on
plot(denoised,'r')
plot(x,'c--');
legend('noisy','denoised','clean');

fb = cwtfilterbank('SignalLength',M);
[cfs,frq] = wt(fb,denoised);


The result looks like :

• Thank you for answering. I never thought of interpolation aspect, this is new to me. Thank you for sharing this knowledge. Could you please clarify these points?(a) What is your intuition behind selecting the interpolation value, U?. (b) can you please mention what is the sampling and nyquist frequency for this kind of signal? This information is required to plot the scalogram image (Questions 2 &3).
– Sm1
Nov 3 '20 at 3:52
• Your recursion is an example of chaotic(?) nonlinear system that's extremely sensitive on intial conditions. I don't think so it does have an analytic expression for a Fourier transform. Furthermore, it does not represent a sampled continuous waveform, instead by nature a discrete type of data, (eventhough you used CWT [cont wavelet transform] on it), hence does not have a Nyquist Frequency. For plotting such discrete-natured data, Nyquist frequency is simply omitted and you focus on discrete-time frequencies in radian per sample (or cycles per sample) notation. Nov 3 '20 at 12:29
• Nevertheless, you can assign a sampling frequency to the observed data (eventhough it's not sampled), considering the time between two consecuitve observations : the period $T_s$ between two sequence values $x_n$ and $x_{n+1}$. This period may represent your sampling period, then your sampling frequency will be $F_s = 1/T_s$ and your Nyquist frequency will be $F_n = F_s/2$ Hz. Nov 3 '20 at 12:33
• The factor $U$ can be any integer > 2. Larger the better but not too large! Say less than 100. But this's not a method of denoising. I used it to disintegrate high freq noise and the signal spectrums, by forcing signal spectrum to low freqs (with the help of interpolation). Then the added white noise was easier to recognise. Whether this is a valid act, depends on your actual noise characteristics. If your signal and noise spectrum were overlapping (as in the original case) then what I have done here will simply be cheating, and not a legitimate denoising of the actual data+noise case... Nov 3 '20 at 12:42
• Thank you once again. So, in the case of discrete chaotic systems such as this one, $T_s$ appears to be. Thus, $F_s =1$ and Nyquist frequency = 0.5. Is my understanding correct?
– Sm1
Nov 3 '20 at 15:58