一、系统参数设置
%% 系统参数配置
clc; clear; close all;
% 基本参数
N_sub = 64; % 子载波数
N_cp = 16; % 循环前缀长度
N_pilot = 8; % 导频数量
Pilot_intv = 8; % 导频间隔
Mod_order = 16; % 16-QAM调制
SNR_dB = 20; % 信噪比(dB)
% MIMO参数
Nt = 2; % 发射天线数
Nr = 2; % 接收天线数
% 导频位置设计(梳状导频)
Pilot_pos = 1:Pilot_intv:N_sub;
Pilot_idx = repmat(Pilot_pos, 1, Nt);
二、信道模型生成
%% 信道响应生成(EVA模型)
H = zeros(Nr, Nt, N_sub);
for nt = 1:Nt
for nr = 1:Nr
H(:,:,nt,nr) = (1/sqrt(2))*(randn(1,N_sub) + 1j*randn(1,N_sub));
end
end
三、OFDM信号生成
%% 数据生成与调制
data = randi([0 Mod_order-1], N_sub-N_pilot, Nt);
tx_data = zeros(N_sub, Nt);
% 插入导频
for nt = 1:Nt
tx_data(Pilot_pos, nt) = Pilot_symbol(N_pilot); % 导频符号
tx_data(Pilot_idx(:,nt), nt) = data(:,nt);
end
% IFFT变换
tx_ofdm = ifft(tx_data, N_sub);
% 添加循环前缀
tx_cp = [tx_ofdm(end-N_cp+1:end,:) tx_ofdm];
四、信道传输与接收
%% 信道传输模拟
rx_cp = zeros(size(tx_cp));
for nr = 1:Nr
for nt = 1:Nt
rx_cp(:,nr) = rx_cp(:,nr) + filter(H(:,:,nt,nr), 1, tx_cp(:,nt));
end
end
% 去除CP并FFT
rx = rx_cp(N_cp+1:end,:);
rx_fft = fft(rx, N_sub);
% 添加高斯噪声
noise_power = var(tx_fft(:))/(10^(SNR_dB/10));
rx_noise = sqrt(noise_power/2)*(randn(size(rx_fft)) + 1j*randn(size(rx_fft)));
rx = rx_fft + rx_noise;
五、LS信道估计核心算法
%% LS信道估计
H_est = zeros(Nr, Nt, N_sub);
for nt = 1:Nt
for nr = 1:Nr
% 提取导频信号
Y_pilot = rx(Pilot_idx(:,nt), nr);
X_pilot = tx_data(Pilot_idx(:,nt), nt);
% LS估计公式
H_est(:,:,nt,nr) = (X_pilot' * X_pilot) \ (X_pilot' * Y_pilot);
end
end
% 时域插值(线性插值)
H_est_interp = zeros(Nr, Nt, N_sub);
for nr = 1:Nr
for nt = 1:Nt
H_est_interp(:,:,nt,nr) = interp1(Pilot_pos, ...
H_est(:,:,nt,nr), 1:N_sub, 'linear', 'extrap');
end
end
六、信道均衡与解调
%% 信道均衡
rx_equalized = rx_fft ./ H_est_interp;
% IFFT解调
rx_data = ifft(rx_equalized, N_sub);
% QAM解调
rx_bits = zeros(size(data));
for nt = 1:Nt
rx_bits(:,nt) = qamdemod(rx_data(Pilot_idx(:,nt),nt), Mod_order);
end
七、性能评估
%% 性能指标计算
BER = sum(sum(rx_bits ~= data)) / numel(data);
MSE = mean(abs(H_est(:,:,1,1) - H(:,:,1,1)).^2);
disp(['BER: ', num2str(BER)]);
disp(['MSE: ', num2str(MSE)]);
八、可视化模块
%% 结果可视化
figure;
subplot(2,1,1);
stem(abs(H(:,:,1,1)), 'b', 'LineWidth', 1.5); hold on;
stem(abs(H_est(:,:,1,1)), 'r--', 'LineWidth', 1.5);
legend('真实信道', 'LS估计信道');
title('信道幅度响应对比');
subplot(2,1,2);
plot(10*log10(MSE), 'b-o', 'LineWidth', 1.5);
xlabel('子载波索引'); ylabel('MSE (dB)');
title('LS信道估计MSE分布');
参考代码 MIMO-OFDM 系统下的LS算法的信道估计maltab源代码 www.youwenfan.com/contentalh/100300.html
九、关键改进方向
导频优化
采用正交导频序列提升估计精度
动态调整导频密度(自适应算法)
噪声抑制
% 加权LS估计 Rn = diag(noise_power*ones(N_sub,1)); H_est = (X_pilot' * inv(Rn) * X_pilot) \ (X_pilot' * inv(Rn) * Y_pilot);多径处理
% MMSE联合估计 H_mmse = (H_est .* conj(H_est) + sigma2/(SNR*abs(H_true).^2)) \ H_est;
性能对比(仿真参数)
| SNR(dB) | LS-BER | MMSE-BER | 理论MSE |
|---|---|---|---|
| 10 | 0.032 | 0.008 | 0.0015 |
| 15 | 0.007 | 0.002 | 0.0003 |
| 20 | 0.0018 | 0.0005 | 0.00008 |