Can anyone post the code for speech enhancement using extended kalman filter? otherwise the linearization of speech signal using jacobian which is performed in EKF?
I got a problem when applying the jacobian. Actually, i'm applying the jacobian to the product of measurement model matrix and the priori AR estimates with the priori measurements. But it is showing that 'the function jacobian is not applicable for the data type Double'. If i apply gradient for that all results are showing infinite or NaN values.
I go through jacobiancsd.m, i applies IMAG to the product for linearization, it result everything in zeros. Finally i performed the mean to every row, it is working but i can't sure about the result.
Here is the code.
rand('state',0);
y2=audioread('ftea_10k.wav'); % mtea_10k speech sample
N=length(y2);
h = zeros(5,N); % matrix of input signal y
P = zeros(5,5*N); % priori or posteri covariance matrix
K = zeros(5,N); % kalman gain
XX = zeros(5,N); % Estimated AR coeffcients
hx = zeros(5,5,N); % nonlinearity due to sp&par multiplication
H = zeros(5,N); % Jacobian
I = eye(5);
y = zeros(1,N); % Input signal
yy = zeros(1,N); % Estimated signal
P(1:5,1:5) = 0.1*I;
XX(1:5,5)=rand(5,1);
r=sqrt(0.01)*sqrt(12)*(rand(N,1)-0.5); % white noise with variance 0.001
for i=1:N
y1(i)=y2(i)+r(i); % Noise Corrupted signal
end
%Start of estimated Filter
Q = 0.0001*eye(5,5); % Process Noise Covariance
R = 0.01; % Measurement Noise Covariance
y=y1(1:N); % Input signal produced
% "For" Loop for estimate filter:
for k=6:N
h(1:5,k)=[y(k-1);y(k-2);y(k-3);y(k-4);y(k-5)];%meas model matrix
hx=h(1:5,k)*XX(1:5,k-1)';
for i=1:5
H(i,k)=mean(hx(1:5,i));
end
%H(1:5,k)=imag(hx(1:5,1:5,k))/5; %linearization
K(1:5,k)=P(1:5,5*k-29:5*k-25)*H(1:5,k)*inv(H(1:5,k)'*P(1:5,5*k-29:5*k-25)*H(1:5,k)+R); % Kalman Gain ph(hph'=r)^-1
P(1:5,5*k-24:5*k-20)=P(1:5,5*k-29:5*k-25)-P(1:5,5*k-29:5*k-25)*H(1:5,k)*inv(H(1:5,k)'*...
P(1:5,5*k-29:5*k-25)*H(1:5,k) +R)*(H(1:5,k)'*P(1:5,5*k-29:5*k-25))+Q; % error covariance matrix p-ph((h'ph+r)p)^-1+q
XX(1:5,k)=(K(1:5,k)*y(k))+(I-K(1:5,k)*H(1:5,k)')*XX(1:5,k-1); % posteriori value of estimate X(k) x-+k(z-hx-)
yy(k)=(H(1:5,k)'*XX(1:5,k));%priori estimate to next iteration
end
Can anyone help me, how to perform linearization?