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.

matlab code for kalman filter in speech enhancement

Status
Not open for further replies.

cooldeeps

Newbie level 1
Newbie level 1
Joined
Sep 17, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
hi all,
here by i need the matlab code for kalman filter in speech enhancement..
also pz tell the threshold methods in wavelet packet transform for enhancement of speech..........

regards,
deepa..
 

salm , plese give me this matlab code
 

clc;
clear all;
close all;
[x fs]=wavread ('fm.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;
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');



there are some errors in this program
 

Hi,
Is there another program?
regards
 

clc;
clear all;
close all;
[x fs]=wavread ('E:\nitish\s1.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;
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');




its working
link a .wav file at wavread statement
 
do anyone have a Wiener Filter algorithm to reconstruct and enhance image


clc;
clear all;
close all;
[x fs]=wavread ('E:\nitish\s1.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;
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');




its working
link a .wav file at wavread statement
 
can u plz give me the explanation and base paper for the above code......
thank u....
 

can anyone help me to get c code for the above matlab code for kalman filter in speech enhancement please
 

hello ,
am looking for any help regarding simulation of identification of friend or foe system in aircraft using matlab. and also codes to genetare pulses of same width but different spacing or time period, say 0.8us-PW spaced 8us apart or 12us apart. how do i put it in programme. kindly help me through above.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top