• try123456
    了解作者
  • matlab
    开发工具
  • 1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 7
    下载次数
  • 2020-07-01 13:34
    上传日期
采用LMS 算法,CM 算法以及CM + 判决反馈算法实现自适应均衡
自适应均衡.zip
  • main.m
    6KB
内容介绍
%% 产生基带BPSK信号 set(0, 'defaultfigurecolor', 'w'); % 基带BPSK信号为未经调制的二进制随机序列 sample_points = 1000; bpsk_input_signal = randsrc(sample_points, 1, [+1, -1]); figure (1); subplot(3,1,1); plot(1:sample_points, bpsk_input_signal, 'k-'); xlabel('采样点下标','FontSize', 12, 'FontWeight', 'Bold'); ylabel('幅度值', 'FontSize', 12, 'FontWeight', 'Bold'); title('基带BPSK序列', 'FontSize', 14, 'FontWeight', 'Bold'); %% 在信道中传播并且加噪 % 信道的冲激响应h_n及信道参数设置 w1 = 2.9; w = 3.3; h_n = zeros(sample_points, 1); for sample_index = 1: sample_points if sample_index >=1 && sample_index <= 3 h_n(sample_index) = 1/2 * (1 + cos(2*pi/w*(sample_index - 2))); else h_n(sample_index) = 0; end end %% 输出信号及噪声信号 power_of_noise = 0.01; noise_signal = sqrt(power_of_noise) * randn(2*sample_points - 1, 1); output_signal = conv(bpsk_input_signal, h_n) + noise_signal; figure (1); subplot(3, 1, 2); plot(1:length(output_signal), output_signal, 'k-'); xlabel('采样点下标','FontSize', 12, 'FontWeight', 'Bold'); ylabel('幅度值', 'FontSize', 12, 'FontWeight', 'Bold'); title('信道输出信号序列', 'FontSize', 14, 'FontWeight', 'Bold'); subplot(3, 1, 3); plot(1:length(noise_signal), noise_signal, 'r-'); xlabel('采样点下标','FontSize', 12, 'FontWeight', 'Bold'); ylabel('幅度值', 'FontSize', 12, 'FontWeight', 'Bold'); title('信道输出信号序列', 'FontSize', 14, 'FontWeight', 'Bold'); %% LMS算法实现自适应均衡 % 假设自适应线性均衡器(LTE)的阶数为100 order_fir_filter = 100; % 输入序列预处理 d_n = bpsk_input_signal(2:end);% 期望信号 processed_input_signal = zeros(order_fir_filter, length(output_signal) - order_fir_filter + 1); for sequence_index = 1: length(output_signal) - order_fir_filter + 1 processed_input_signal(:, sequence_index) = output_signal(sequence_index:sequence_index + order_fir_filter - 1); end % 估计自相关矩阵 R_estimate = zeros(order_fir_filter, order_fir_filter); for sequence_index = 1:length(output_signal) - order_fir_filter + 1 R_estimate = R_estimate + processed_input_signal(:, sequence_index)*... processed_input_signal(:, sequence_index)'; end R_estimate = R_estimate/(length(output_signal) - order_fir_filter + 1); u_lms = 0.1 * 1/trace(R_estimate); omega_lms = zeros(order_fir_filter, sample_points); omega_0_lms = zeros(order_fir_filter, 1); omega_lms(:, 1) = omega_0_lms; mse_error_lms = zeros(sample_points - 1, 1); % LMS算法的权向量迭代 for sequence_index = 1:sample_points - 1 d = d_n(sequence_index);% 当前的期望输出 y = omega_0_lms' * processed_input_signal(:, sequence_index); omega_0_lms = omega_0_lms + 2*u_lms*(d - y)*processed_input_signal(:, sequence_index); % 均方误差的收敛曲线 mse_error_lms(sequence_index) = sum((d_n(sequence_index) - omega_0_lms' * processed_input_signal(:, sequence_index)).^2); omega_lms(:, sequence_index + 1) = omega_0_lms; end %% cm算法实现自适应均衡 % 选择了与MSE不同的代价函数 omega_cm = zeros(order_fir_filter, sample_points); omega_0_cm = 0.1*randn(order_fir_filter, 1); omega_cm(:, 1) = omega_0_cm; mse_error_cm = zeros(sample_points - 1, 1); % 步长选择,尽量选择较小的正实数 u_cm = 0.001; % cm算法的权向量迭代 for sequence_index = 1:sample_points - 1 d = bpsk_input_signal(sequence_index)^4/bpsk_input_signal(sequence_index)^2;% 当前的期望输出 y = omega_0_cm' * processed_input_signal(:, sequence_index); omega_0_cm = omega_0_cm - u_cm*y*(y^2 - d)*processed_input_signal(:, sequence_index); % 均方误差的收敛曲线 mse_error_cm(sequence_index) = sum((d_n(sequence_index) - omega_0_cm' * processed_input_signal(:, sequence_index)).^2); omega_cm(:, sequence_index + 1) = omega_0_cm; end %% cm+判决反馈实现自适应均衡 % 判决反馈器由前向FIR滤波器(FFF)和反向滤波器(FBF)组成 order_fff_filter = 100;% 前向FIR滤波器的阶数 order_fbf_filter = 10;% 反向滤波器FBF的阶数 % 前向FIR滤波器的权重 omega_fff_cm = zeros(order_fff_filter, sample_points - order_fbf_filter); % 反向FIR滤波器的权重 omega_fbf_cm = zeros(order_fbf_filter, sample_points - order_fbf_filter); omega_cm_ = zeros(order_fff_filter+order_fbf_filter, sample_points - order_fbf_filter); mse_error_cm_ = zeros(sample_points - order_fbf_filter - 1, 1); omega_fff_cm_0 = 0.1*randn(order_fff_filter, 1); omega_fbf_cm_0 = 0.1*randn(order_fbf_filter, 1); omega_cm_0 = cat(1, omega_fff_cm_0, omega_fbf_cm_0);% cat omega_fff and omega_fbf % 步长设置 u_cm = 0.01; % 梯度下降 for iter = 1: sample_points - order_fbf_filter - 1 d = bpsk_input_signal(sequence_index)^4/bpsk_input_signal(sequence_index)^2;% 当前的期望输出 temp = (omega_fff_cm_0' * processed_input_signal(:, sequence_index:sequence_index + order_fbf_filter - 1))'; % 判决器 temp(temp>0) = 1; temp(temp<0) = -1; y = omega_cm_0' * [processed_input_signal(:, sequence_index);temp]; omega_cm_0 = omega_cm_0 - u_cm*y*(y^2 - d)*[processed_input_signal(:, sequence_index);temp]; mse_error_cm_(iter) = sum((d_n(sequence_index) - omega_cm_0(1:order_fff_filter, :)' * processed_input_signal(:, sequence_index)).^2); omega_fff_cm_0 = omega_cm_0(1:order_fff_filter, :); omega_cm_(:, iter + 1) = omega_cm_0; end %% 可视化MSE ERROR的迭代曲线 figure (2); plot(1:sample_points - 1, mse_error_lms, 'k-'); xlabel('迭代次数', 'FontSize', 12, 'FontWeight', 'Bold'); ylabel('MSE Error', 'FontSize', 12, 'FontWeight', 'Bold'); title('LMS算法实现自适应均衡的误差迭代曲线', 'FontSize', 14, 'FontWeight', 'Bold'); figure (3); plot(1:sample_points - 1, mse_error_cm, 'k-'); xlabel('迭代次数', 'FontSize', 12, 'FontWeight', 'Bold'); ylabel('MSE Error', 'FontSize', 12, 'FontWeight', 'Bold'); title('cm算法实现自适应均衡的误差迭代曲线', 'FontSize', 14, 'FontWeight', 'Bold'); figure (4); plot(1:sample_points - order_fbf_filter - 1, mse_error_cm_, 'k-'); xlabel('迭代次数', 'FontSize', 12, 'FontWeight', 'Bold'); ylabel('MSE Error', 'FontSize', 12, 'FontWeight', 'Bold'); title('cm+判决反馈算法实现自适应均衡的误差迭代曲线', 'FontSize', 14, 'FontWeight', 'Bold');
评论
    相关推荐