iggyboy
Member level 2
Helo again. Time for a new whine:
I need help filtering a very noisy signal. See attached file. I read a bit about filters and decided to implement a windowed sinc filter. I chose a 32 point blackmann window:
const unsigned int blackmann[]={
0,
245,
1023,
2448,
4677,
7873,
12151,
17539,
23940,
31119,
38707,
46226,
53142,
58914,
63069,
65251,
65268,
63120,
58993,
53243,
46341,
38827,
31237,
24048,
17632,
12227,
7932,
4720,
2476,
1040,
253,
0
};
which I scaled hoping to get the job done using integers. Here is the algorithm
The above does not work. All I get is a more or less distorted bell, so I guess I am really missing something, right? What is that?
I should point out that the signal which is to be filtered has a strong DC component and many HF components ranging from a 50 Hz to approx. 500kHz plus the noise. I am trying to cut the HF with the sinc filter and then average out the noise with a moving average filter. Is this the right approach?
Any advice/thoughts wellcomed.
I need help filtering a very noisy signal. See attached file. I read a bit about filters and decided to implement a windowed sinc filter. I chose a 32 point blackmann window:
const unsigned int blackmann[]={
0,
245,
1023,
2448,
4677,
7873,
12151,
17539,
23940,
31119,
38707,
46226,
53142,
58914,
63069,
65251,
65268,
63120,
58993,
53243,
46341,
38827,
31237,
24048,
17632,
12227,
7932,
4720,
2476,
1040,
253,
0
};
which I scaled hoping to get the job done using integers. Here is the algorithm
Code:
unsigned int filter_in[33];
unsigned long filter_out[64];
unsigned char indeks_sinc=0;
unsigned char out_index=0;
unsigned char window_index=0;
unsigned char in_index=0;
filter_in[indeks_sinc]=ADCBUF4;
if(indeks_sinc<32) indeks_sinc++;
else{
indeks_sinc=0;
for(out_index=0;out_index<63;out_index++){
filter_out[out_index]=0;
}
asm("nop");
asm("nop");
asm("nop");
asm("nop");
asm("nop");
for(window_index=0;window_index<31;window_index++){
for(in_index=0;in_index<32;in_index++){
filter_out[in_index+window_index]=filter_out[in_index+window_index]+filter_in[in_index]*blackmann[window_index];
}
}
asm("nop");
asm("nop");
asm("nop");
asm("nop");
asm("nop");
}
The above does not work. All I get is a more or less distorted bell, so I guess I am really missing something, right? What is that?
I should point out that the signal which is to be filtered has a strong DC component and many HF components ranging from a 50 Hz to approx. 500kHz plus the noise. I am trying to cut the HF with the sinc filter and then average out the noise with a moving average filter. Is this the right approach?
Any advice/thoughts wellcomed.