Wavelet denoising c language program

1. Wavelet threshold denoising theory

Wavelet threshold denoising is to decompose the signal, then perform threshold processing on the decomposed coefficients, and finally reconstruct the denoised signal. The main theoretical basis of the algorithm is that the wavelet transform has strong de-data correlation, which can make the energy of the signal concentrate in some small wavelet coefficients in the wavelet domain; while the energy of the noise is distributed in the whole wavelet domain. Therefore, after wavelet decomposition, the amplitude of the wavelet coefficient of the signal is greater than the amplitude of the coefficient of the noise. It can be considered that the wavelet coefficients with larger amplitudes are generally dominated by signals, while the smaller amplitude coefficients are largely noise. Thus, thresholding can be used to preserve the signal coefficients while reducing most of the noise figure to zero. The specific processing of wavelet threshold shrinkage denoising is: wavelet decomposition of the noisy signal on each scale, set a threshold, the wavelet coefficient whose amplitude is lower than the threshold is set to 0, and the wavelet coefficient is higher than the threshold or Completely reserved, or do the corresponding "shrinkage" processing. Finally, the wavelet coefficients obtained after processing are reconstructed by inverse wavelet transform to obtain the denoised signal.

2, wavelet threshold denoising c language program

This program is used for signal processing analysis, highlighting the front-end processing of singular values, wavelet packet decomposition of signals, implemented in C language, for reference only.

#include

#include

#include

#include

#defineLENGTH4096//Signal length

#defineDB_LENGTH8//Daubechies wavelet base tight support length

/************************************************* *****************

* One-dimensional convolution function

* Description: Circular convolution, the length of the convolution result is the same as the length of the input signal

* Input parameters: data[], input signal; core[], convolution kernel; cov[], convolution result;

*n, input signal length; m, convolution kernel length.

************************************************** ****************/

/*voidCovluTIon(doubledata[],doublecore[],doublecov[],intn,intm)

{

inTI=0;

Intj=0;

Intk=0;

/ / Clear cov[]

For(i=0;i"n;i++)

{

Cov[i]=0;

}

//previous m/2+1 line

i=0;

For(j=0;j“m/2;j++,i++)

{

For(k=m/2-j;k“m;k++)

{

Cov[i]+=data[k-(m/2-j)]*core[k];//k for core[k]

}

For(k=nm/2+j;k“n;k++)

{

Cov[i]+=data[k]*core[k-(nm/2+j)];//k for data[k]

}

}

//The middle nm line

For(i=m/2;i"=(nm)+m/2;i++)

{

For(j=0;j“m;j++)

{

Cov[i]+=data[im/2+j]*core[j];

}

}

//last m/2-1 line

i=(nm)+m/2+1;

For(j=1;j"m/2;j++,i++)

{

For(k=0;k“j;k++)

{

Cov[i]+=data[k]*core[mjk];//k for data[k]

}

For(k=0;k“mj;k++)

{

Cov[i]+=core[k]*data[n-(mj)+k];//k for core[k]

}

}

}

*/

/ / Define a linear convolution

voidCovluTIon(doubledata[],doublecore[],doublecov[],intn,intm)

{

inTI=0;

Intj=0;

Intt=0;

/ / Clear cov[]

For(j=0;j"n+m-1;j++)

{

Cov[j]=0;

}

For(j=0;j“m+n-1;j++)

{

If(j"=m-1)// front m lines

{

For(i=0,t=j;t》=0;i++,t--)

Cov[j]+=data[i]*core[t];

}

Elseif (j "= n-1) / / intermediate nm line

{

For(i=j-m+1,t=m-1;t》=0;i++,t--)

Cov[j]+=data[i]*core[t];

}

Else / / behind m lines

{

For(i=j-m+1,t=m-1;i"n;i++,t--)

Cov[j]+=data[i]*core[t];

}

}

}

Compression Driver

Compression Driver,Tweeter Driver Unit,Compression Driver Speaker,High Frequency Compression Driver

Guangzhou Yuehang Audio Technology Co., Ltd , https://www.yhspeakers.com

Posted on