% == ---采用迫零算法 ==%
clc;
clear;
close all;
warning off;
addpath(genpath(pwd));
flag = 0; % =1时为调试模式
% =0时为 不同SNR下测误码率模式
N=2000000; %二进制信源的长度,测误码率时使用的N
h = [0.6 -0.3 0.1]; %多径响应序列
order = 1:5; %C的阶数,可以看阶数增大的效果(阶数越大,抗多径的效果越好,星座点越集中)
Sample_Rate = 1; %插值倍数(抗多径仿真时,不带插值滤波模块,故插值速率=1)
SNRdB = 5:15; % SNR=Eb/(N0/2)(单位:dB),测误码率模式下,从2dB测到11dB
Loops = [1,1,1,1,1,1,1,1,1,1,1]; %N=1000000时单循环
BER=zeros(length(order),length(SNRdB)); %记录不同阶数下,不同信噪比的误码率,以便绘制曲线族
%******************************************************%
hh = [h(1) 0 0
h(2) h(1) 0
h(3) h(2) h(1) ];
%------------------------------------------------------%
for ii = 1:length(order) % 主循环,逐次仿真每个阶数order条件
disp(['目前仿真到oder=',num2str(order(ii))]); %运行过程显示现在跑到第几轮
hh = zeros(order(ii), order(ii));
hh(1:order(ii),:) = eye(order(ii)) * h(1);
hh(2:order(ii),1:order(ii)-1) = hh(2:order(ii),1:order(ii)-1) + eye(order(ii)-1) * h(2);
hh(3:order(ii),1:order(ii)-2) = hh(3:order(ii),1:order(ii)-2) + eye(order(ii)-2) * h(3);
dd = zeros(order(ii),1); %h(t)与c(t)卷积后是delta函数
dd(1) = 1;
cc = hh \ dd; % H * C = D,求出均衡器的C序列
for i = 1:length(SNRdB) % 逐次仿真每个SNR条件
disp(['目前仿真到第',num2str(i),'轮:','SNR=',num2str(SNRdB(i)),'dB']); %运行过程显示现在跑到第几轮
TotalError = 0; % 每个 SNR 的仿真前,清空错误计数
SNR = 10^(SNRdB(i)/10); % 从 dB 单位的信噪比计算实际 SNR
for JJJ = 1:Loops(i) % 次循环,相同信噪比条件下重复多次,以达到足够错误计数的要求
x=randsrc(1,N,[0,1;0.5,0.5]);%------------------生成随机0,1数据
x1=my_BPSK(x); %------------------BPSK调制
%-----------------------------------------------多径信道+噪声
x2 = conv(x1,h); % 多径
x3 = awgn(x2,SNR/Sample_Rate,'measured','linear'); %通过AWGN信道
if flag == 1 %---若是调试模式,画需要观测的星座图
figure %---多径影响下(无噪声)的星座图
x2_ = x2(3:length(x2)-2); %扣去卷积的头尾各两个
plot(x2_,0,'r*'),ylim([-2,2]),xlim([-2,2]),title('多径影响下的星座图');
grid on;
figure %---多径+噪声影响下的星座图
x3_ = x3(3:length(x3)-2);
plot(x3_,0,'m*'),ylim([-2,2]),xlim([-2,2]),title('多径影响下的星座图');
grid on;
end
%---------------------------------------------------接收端 均衡
x6 = conv(x3,cc); % 接收端均衡模块
x6_ = x6(1:length(x)); %删去后面拖尾的几个零
if flag == 1 %---若是调试模式,画需要观测的星座图
figure %---均衡后的星座图
plot(x6_,0,'b*'),ylim([-2,2]),xlim([-2,2]),title('均衡后的星座图');
grid on;
end
x7 = (1-sign(x6_))/2; % ------------------ 解调与判决
TotalError = TotalError + sum(abs(x - x7)); % --- 统计这次N个点的误码
end
BER(ii,i) = TotalError / N / Loops(i); % --- 计算累积误码率
end
end
figure
semilogy(SNRdB, BER(1,:),'r.-'); % --- 绘制仿真结果 order=1时的误码率
ylim([10^(-6) 10^(-1)]);
hold on;
semilogy(SNRdB, BER(2,:),'bo-'); % --- 绘制仿真结果 order=2时的误码率
hold on;
semilogy(SNRdB, BER(3,:),'g+-'); % --- 绘制仿真结果 order=3时的误码率
hold on;
semilogy(SNRdB, BER(4,:),'mv-'); % --- 绘制仿真结果 order=4时的误码率
hold on;
semilogy(SNRdB, BER(5,:),'k.-'); % --- 绘制仿真结果 order=5时的误码率
legend('一阶迫零均衡器','二阶迫零均衡器','三阶迫零均衡器','四阶迫零均衡器','五阶迫零均衡器');
xlabel('SNR(单位:dB)');
ylabel('误码率');
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1.版本:matlab2021a,包含仿真操作录像,操作录像使用windows media player播放。 2.领域:抗多径性能 3.内容:通过MATLAB对比ZF均衡算法和LMS均衡算法的抗多径误码率性能。其中ZF均衡器对比了1阶到5阶破零均衡器的误码率。 4.注意事项:注意MATLAB左侧当前文件夹路径,必须是程序所在文件夹位置,具体可以参考视频录。
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![m](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/AVI.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 6 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- 不二子8632024-01-20感谢资源主分享的资源解决了我当下的问题,非常有用的资源。
- weixin_580908822024-04-19总算找到了自己想要的资源,对自己的启发很大,感谢分享~
- 岩浆美人鱼2023-03-24资源和描述一致,质量不错,解决了我的问题,感谢资源主。
![avatar](https://profile-avatar.csdnimg.cn/6534a49295004b5796c3956cb3f87481_ccsss22.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
fpga和matlab
- 粉丝: 16w+
- 资源: 2583
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)