Part Number: SW-EK-TM4C1294XL
Tool/software: Code Composer Studio
I was sampling a Hanning pulse from a PWT sensor. I needed to take a wavelet transform of the sampled waveform. I wrote a very basic code using for loops for implementing the 1-D continuous wavelet trasnform by multiplying the scaled adn time shifted wavelets. But the code is very slow and takes about 20 mins to find the Wavelet transform. The wavelet that I am using for 1-D CWT is Morlet wavelet. Is there a better algorithm for implementing the wavelet transform. If yes is a sample code availabe or some references in which they have explained the algorithm. Is there any library that can perfom1-D wavelet transform?
I have attached the function that I have written. The array g_ui8RxBufA[] contains the sampled waveform from ADC.
void CWT(uint32_t scale)
{
uint32_t p,j,k,l;
for(l = 0; l < 512; l++)
{
signal[l] = (float32_t)g_ui8RxBufA[l] * (3.3/4096.0);
}
for( p=1;p<=scale;p++)
{
for( j=0;j<CWT_LENGTH;j++)
{
for( k=0;k<CWT_LENGTH;k++)
{
cos_1 = cos(5*((k-j)/p));
sqrt_1 = sqrt(p);
temp_p = (float32_t)p;
temp = (-1*((k-j)/temp_p)*((k-j)/temp_p))/2;
exp_1 = exp(temp);
temp_wavelet = exp_1*cos_1/sqrt_1;
coefs[p-1][j] = coefs[p-1][j] + signal[k]*temp_wavelet;
}
}
}
}
Thanks for the help!