Dear madlab88 & shams_313
As I mentioned in shams_313's thread, Kay's book would be great helpful your project. One of chapter deals with channel modeling and filtering about the kalman filter.
< Fundamentals of Statistical Signal Processing, Volume I: Estimation Theory (v. 1) by Steven M. Kay >
Here's my codes for single-carrier channel estimation using kalman filter. This codes is basically and based on a Kay's book.
I think... you can easily extend this code with multi-carrier system.
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%
% File Name : main_Kalman_CE.m
% Description: Time varying channel estimation using Kalman filter
%
% Date : 2009.8.3. (by chano.)
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
clear all;
close all;
% % % % % % % % % % % % Parameter Define % % % % % % % % % % % %
N = 101; % number of observation
p = 2; % number of multipath
A = [0.99 0; 0 0.999];
sigma_u = 0.01;
Q = [sigma_u^2 0; 0 sigma_u^2];
sigma = sqrt(0.1); % observation noise S.D
H = [1; .9]; % h[-1]
h_hat_1 = [0; 0]; % initial channel state, h_hat[-1|-1]
M_1 = 100*eye(p); % initial MMSE val, M[-1|-1]
w = sigma*randn;
v = [zeros(5,1); ones(5,1);zeros(5,1); ones(5,1)];
v = [v;v;v;v;v;v]; % channel input, v[n]
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
h_mat_True = zeros(p,N);
h_mat_Est= zeros(p,N);
K_mat= zeros(p,N);
M_mat= zeros(p,N);
x_free_vec = zeros(1,N);
x_vec= zeros(1,N);
for n = 1 : N-1
U = sigma_u*randn(p,1);
H = A*H+U; % unknown channel update
V = [ v(n+1);v
]; % known input
w = sigma*randn; % wgn
x_free = V'*H ; % Noiseless channel output
x = x_free + w; % Channel Output
h_hat_2 = A*h_hat_1;
M_2 = A*M_1*A'+Q;
K = ( M_2*V )./ ( sigma^2 + V'*M_2*V );
h_hat_1 = h_hat_2 + K*(x -V'*h_hat_2 );
M_1 = ( eye(p) - K*V' )*M_2;
% % % for plotting % % %
x_vec
= x;
x_free_vec
= x_free;
h_mat_True
,n) = H;
h_mat_Est
,n) = h_hat_2;
K_mat
,n) = K;
M_mat
,n) = [ M_1(1,1); M_1(2,2) ];
end
figure(1); %title('Realization of TDL coefficients');
subplot(2,1,1);
plot(h_mat_True(1,1:100), '--', 'LineWidth', 2);
hold on; grid on;
plot(h_mat_Est(1,1:100),'r', 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Tap weight, h_n[0]');
legend('True','Estimate');
ylim( [0 2] )
subplot(2,1,2);
plot(h_mat_True(2,1:100), '--', 'LineWidth', 2);
hold on; grid on;
plot(h_mat_Est(2,1:100), 'r', 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Tap weight, h_n[1]');
legend('True','Estimate');
ylim( [0 2] )
figure(2);
subplot(3,1,1);
plot(v(1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Channel input, v[n]');
ylim( [-1 2.5] )
subplot(3,1,2);
plot(x_free_vec(1,1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Noiseless channel, y[n]');
ylim( [-1 2.5] )
subplot(3,1,3);
plot(x_vec(1,1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Channel input, v[n]');
ylim( [-1 2.5] )
figure(3);
subplot(2,1,1);
plot(K_mat(1,1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Kalman gain, K_1[n]');
ylim( [-.6 1.1] )
subplot(2,1,2);
plot(K_mat(2,1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Kalman gain, K_2[n]');
ylim( [-.6 1.1] )
figure(4)
subplot(2,1,1);
plot(M_mat(1,1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Min. MSE, M_11[n]');
ylim( [0 0.2] )
subplot(2,1,2);
plot(M_mat(2,1:100), 'LineWidth', 2);
xlabel('Sample number, n');
ylabel('Min. MSE, M_22[n]');
ylim( [0 0.2] )