# eliminate noise using kalman filter

Status
Not open for further replies.

#### fuzzhan

##### Newbie level 3
hi..i really need a help..im a final year student..im still new with matlab..i need to design a filter to eliminate noise in speech processing..im using kalman filter..plizz help me..i really need a help..plizz somebody help me give the coding

#### Mityan

##### Full Member level 5
The simpliest Kalman may look like this (I use it for sensors processing):

Code:
function Array_FK = Simple_Kalman_fcn(Array, Q, R)
len = size(Array,1);
cur_state = Array(1);
cur_cov = 0;
Array_FK = zeros(len,1);
for i = 1:1:len
x = cur_state;
P = cur_cov + Q;
K = P/(P + R);
cur_state = x + K*(Array(i) - x);
cur_cov = (1 - K)*P;
Array_FK(i) = cur_state;
end

Input - Array - this is your data vector. Output - Array_FK - the vector of the same length.
Parameter R - variance og your noise. You may estimate it in the following way: for example, first 1000 samples of your speech data is silence (noisy). Then R = var(Array(1:1000));
Parameter Q you adjust manually to get a result that you will like.

#### fuzzhan

##### Newbie level 3
that the code is same if i want to use to filtering noise in speech or audio

#### Mityan

##### Full Member level 5
I think you should try it. Plot the input and output diagrams in the same axis and adjust Q to get a nice noisy signal shaping at output.

Status
Not open for further replies.

Replies
0
Views
1K
Replies
0
Views
891
Replies
0
Views
1K
Replies
0
Views
3K
Replies
0
Views
2K