estimator_mmse.m
资源名称:MIMO-OFDM.rar [点击查看]
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:2k
源码类别:
传真(Fax)编程
开发平台:
Matlab
- function [ H_est , MSE ] = estimator_mmse( Recv , Training , Method , N_subc_Remain , H_ideal)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 进行基本的MMSE和MMSE-DFT信道估计
- % 计算出均方误差.
- % 输入: Recv, 频域接收到的各个子载波上的复数信号, N_subc(子载波数) 行, N(训练OFDM符号个数)列的复数向量
- % Training , 发送的训练序列 , N_subc 行, N 列的向量
- % 注意: 训练序列中不能有零, 否则出错.
- % Method, 信道估计的方法 ,正整数, 1--- MMSE估计, 2 ---MMSE-DFT估计的DFT改进
- % N_subc_Remain, LS估计的DFT改进方法,所保留的子载波数. 为正整数值.
- % 建议选取改值等于最大多径时延对应的时域样点数
- %
- %
- % 输出: H_est, 估计得到的各个子载波上的频域响应, N_subc 行, 1列的复数向量
- % MSE, 本次估计的均方误差
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- N_subc = size(Recv,1); % 子载波数
- H_est = zeros(N_subc ,1);
- N = size(Recv,2);
- % 接收信号乘上训练序列的共轭, 除以训练序列的模值的平方,得到LS估计的信道响应
- H_ls = Recv.*conj(Training)./abs(Training).^2;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 如果仅输入两个参数
- if nargin == 2
- H_est = H_ls; % LS估计
- MSE = [];
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 如果输入五个参数
- elseif nargin == 5
- if Method == 1
- H_est = H_ls; % LS估计
- elseif Method == 2 % LS估计DFT改进
- % 首先变换到时域
- time_domain = ifft(fftshift(H_ls,1)) * sqrt(N_subc);
- time_cut = zeros(N_subc,N);
- leakage = 0; % 能量泄漏的子载波数
- % 保留时域能量集中的N_subc_Remain个样点
- time_cut( 1: N_subc_Remain,: ) = time_domain( 1: N_subc_Remain,: );
- % 保留能量泄漏的leakage个样点
- time_cut( N_subc - leakage : N_subc,: ) = time_domain( N_subc - leakage : N_subc,: );
- % 变换到频域
- H_ls_dft = fftshift(fft(time_cut) * 1/sqrt(N_subc),1);
- H_est = H_ls_dft;
- else
- error('子程序estimator输入参数不匹配!');
- end
- % 计算均方误差
- diff = H_ideal - H_est;
- MSE = sum(sum( abs(diff).^2 )) / (N_subc*N) ;
- end