# denosing using soft thresholding or hard thresholding in matlab

let us consider following code

clear all;
clc;
f1=10;
f2=40;
fs=100;
ts=1/fs;
t=0:ts:2.93;
x=19*sin(2*pi*f1*t).*((t<0.25)+(t>1))+20*cos(2*pi*f2*t).*((t>=0.25)+(t<1))+1.5*randn(size(t));
plot(t,x);
axis tight
title('Signal');
xlabel('Time or Space');


output of plot is given i would like to apply denosing method using wavelet method,generally i can compute continuous wavelet transform using cwt command,but how exactly procedures can be done for denosing signal and for reconstruction?please help me ,just i need few matlab codes for this.thanks you very much

EDITED :

i have added to my code following command

scales=1:32;
wname = 'gaus4';
coefficients=cwt(x,scales,wname,'plot');


and got result know methods like soft and hard thresholding,there ar esteps

Apply wavelet transform to the noisy signal to produce the noisy wavelet coefficients to the level which we can properly distinguish the PD occurrence. •Select appropriate threshold limit at each level and threshold method (hard or soft thresholding) to best remove the noises. • Inverse wavelet transform of the thresholded wavelet coefficients to obtain a denoised signal.

in my case coefficients are two dimensional matrix,so how can i continue?

i have tried following code

[XD,CXD,LXD] = wden(x,'sqtwolog','s', 'mln',4,'gaus4');


but there is error

************************************************
ERROR ...
------------------------------------------------
wfilters ---> The wavelet gaus4 is not valid!
************************************************

Error using wfilters (line 92)
Invalid argument value.

Error in wavedec (line 32)
[Lo_D,Hi_D] = wfilters(IN3,'d');

Error in wden (line 72)
[c,l] = wavedec(x,n,w);


The wden function should do exactly what you need: 1-D de-noising. The documentation states that the wavelet family must be orthogonal. The family you specified - Gaussian wavelets - are not orthogonal, thus it is not possible to use it for wavelet denoising.
You'll find some information on the different wavelet families in the MATLAB help page on waveletfamilies.