Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help to implement a kalman filter

Status
Not open for further replies.

AkhilaSayooj

Newbie level 5
Joined
Oct 24, 2016
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
57
hai all,
I am working with audio enhancement using kalman filter ,if anybody working in this same stream,please let me know
 

Hi,

what hardware, what compiler, sample rate, dataformat....
Please try to give all informations at once, not piece by piece.

Klaus
 
Hi ,
since I am a starter in this audio processing , I was studying a code I got from edaboard discussion , i need to know the way in which they implemented the gain equation. can any body help me to understand the code ?
Code:
clc; 
clear all; 
close all; 
load handel.mat
filename = 'handel.wav';
 [x, fs]=audioread('handel.wav');
v=rand (size(x)); % adding a random Gaussian noise eqn 
orig=x+v; % noisy speech signal 
no=orig; 
N=length(x); % length of the input signal 
F = zeros (5, N); % initialization of standard transition matrix 
I = eye (5); % transition matrix 
H = zeros (5,N); 
sig = zeros (5, 5*N); % priori or posteri covariance matrix. 
K = zeros (5, N); % kalman gain. 
XX = zeros (5, N); % kalman coefficient for yy. 
y = zeros (1, N); % requiring signal (desired signal) 
vv = zeros (1, N); % predicted state error vector 
yy = zeros (1, N); % Estimated error sequence 
Q = 0.0001*eye (5, 5); % Process Noise Covariance. 
R = 0.1; % Measurement Noise Covariance 
y=x (1: N); % y is the output signal produced. 
sig (1:5, 1:5) = 0.1*I; 
for k=6: N 
F(1:5,k)=-[y(k-1);y(k-2);y(k-3);y(k-4);y(k-5)]; 
H(1:5,k)=-[yy(k-1);yy(k-2);yy(k-3);yy(k-4);yy(k-5)]; 
K(1:5,k)=sig(1:5,5*k-29:5*k-25)*F(1:5,k)*inv(F(1:5,k)'*sig(1:5,5*k-29:5*k-25)*F(1:5,k)+R); %Kalman Gain 
sig(1:5,5*k-24:5*k-20)=sig(1:5,5*k-29:5*k-25)-sig(1:5,5*k-29:5*k-25)*F(1:5,k)*inv(F(1:5,k)'*sig(1:5,5*k-29:5*k-25)*F(1:5,k) +R)*(F(1:5,k)'*sig(1:5,5*k-29:5*k-25))+Q; % error covariance matrix 

XX(1:5,k) =(I - K(1:5,k)*F(1:5,k)')*XX(1:5,k-1) + (K(1:5,k)*y(k)); % posteriori value of estimate X(k) 
orig (k) =y (k)-(F (1:3, k)'*XX (1:3, k)); % estimated speech signal 
yy (k) = (H (1:5, k)'*XX (1:5, k)) + orig (k); % no. of coefficients per iteration 
end; 
for it = 1:1: length(x) 
MSE (it) = orig (it) - x (it); 
end; 
sound(x,fs )
pause(size(x,1)/fs);
sound(no,fs)
pause(size(no,1)/fs);
sound(orig,fs)
% pause(size(y1,1)/fs);
sound(x,fs )
tt = 1:1: length(x); 
figure (1); subplot (311); plot(x); title ('ORIGINAL SIGNAL'); 
subplot (312); plot (no); title ('Noisy Speech Signal'); 
subplot (313); plot (orig); title ('ESTIMATED SIGNAL'); 
figure (2); plot (tt, x, tt, orig); title ('Combined plot'); legend ('original’,’ estimated'); 
figure (3); plot (MSE.^2); title ('Mean square error');
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top