今天这个是真正的过了信道的信号。

单载波QPSK。QPSK算是通过了。

简直就是个速成班啊……惨…………

关于CMA的介绍,可以参考Matlab的文档。

Reviews:Matlab中关于CMA的介绍

%%

% 单载波QPSK 接收端

% CMA均衡,LMS训练,BER循环计算

% 2017年5月18日10:37:53

clear;

close all;

clc

%%

rand_seed = 0;

rand('seed',rand_seed);

randn('seed',rand_seed);

% Set up parameters and signals.

M = 4; % Alphabet size for modulation

baud_rate = 100; % Baud rate

f_carrier1 = 75; % Carrier frequency

Nsym = 10000; % Number of symbols

msg = randi([0 M-1],Nsym,1); % Random message

hMod = comm.RectangularQAMModulator(M);

modmsg = step(hMod,msg); % Modulate using QAM. % 映射后的基带信号

trainlen = 3000; % Length of training sequence

rolloff = .3; % 滚降因子

span = 20 ; % 截断长度

sps = 10; % Samples per symbol

rrcFilter=rcosdesign(rolloff,span,sps,'sqrt'); %根升余弦滚降滤波器,‘sqrt’均方根升余弦;‘normal’升余弦

fs = baud_rate*sps; % 时间采样率,时间采样间隔为 1/fs 秒

Tsymbol=1/baud_rate;

% 2. 脉冲成型

% txSig = upfirdn(modmsg, rrcFilter, sps); % 发送端的基带复波形信号

rrcLen=length(rrcFilter);

msg_upsample=upsample(modmsg,sps);

msg_pulse_rrc=conv(msg_upsample,rrcFilter);

msg_upsample_len=length(msg_pulse_rrc);

txSig=msg_pulse_rrc(rrcLen/2:msg_upsample_len-rrcLen/2);

t = (0:1/fs:((length(txSig)-1)/fs)).';

T = t(end)+1/fs;

df = 1/T;

freq = -fs/2:df:fs/2-df;

cos1 = cos(2*pi*f_carrier1 * t);

sin1 = sin(2*pi*f_carrier1 * t);

x_upconv = real(txSig).* cos1 + imag(txSig) .* sin1;

%% === 接收端

x_training_wave = x_upconv;

x_training_msg = modmsg;

% x_received = Rx_oscilloscope('osc');

load ./rxdata/oscCAP_7osc.txt;

x_received=oscCAP_7osc;

%%

% 1. 同步

x_resampled = resample(x_received,1,1);

for k = 1 : 5

try

x_sync = sync_two_signals( x_resampled,x_training_wave,k,3);

is_sync = 1;

catch

is_sync = 0;

fprintf('未同步\n');

end

if is_sync == 1

fprintf('同步\n');

break;

end

end

x_sync = x_sync/max(abs(x_sync));

x_training_wave = x_training_wave/max(abs(x_training_wave));

%%

% close all;

% plot(x_sync(1e3:2000),'r');hold on;

% plot(x_training_wave(1e3:2000),'b');

%%

% 2. 下变频 + 匹配滤波

% x_sync = x_training_wave;

%

t = (0:1/fs:((length(x_sync)-1)/fs)).';

T = t(end)+1/fs;

df = 1/T;

freq = -fs/2:df:fs/2-df;

% figure(1);

% plot(freq,20*log10(abs(fftshift(fft(x_sync))/max(abs(fftshift(fft(x_sync)))))));

% ylim([-100,10])

% xlim([0,freq(end)])

% grid on;

% xlabel('频率(Hz)');

% title('接收信号');

cos1 = cos(2*pi*f_carrier1 * t);

sin1 = sin(2*pi*f_carrier1 * t);

xi_dnconv = x_sync .* cos1;

xq_dnconv = x_sync .* sin1;

x_dnconv= xi_dnconv + 1j * xq_dnconv;

dn_offset = 0;

rxMatchFilt=conv(x_dnconv,rrcFilter);

msg_upsample_len=length(rxMatchFilt);

rxFilt=rxMatchFilt(rrcLen/2:msg_upsample_len-rrcLen/2);

rxFilt=downsample(rxFilt,sps,dn_offset);

close all;

scatterplot(rxFilt);

%% CMA(Matlab)

close all;

nWeights = 20;

stepSize = 0.001;

alg = cma(stepSize);

eqCMA = lineareq(nWeights,alg);

eqCMA.SigConst = step(hMod,(0:M-1)')';

eqCMA.leakagefactor = 1;

% eqCMA.ResetBeforeFiltering = 0; % Maintain continuity between iterations.

% eqCMA.Weights = [ones(1,length(eqCMA.Weights)-1) 1];

eqCMA.Weights = [zeros(1,length(eqCMA.Weights)-1),1];

[symbolcma,~] = equalize(eqCMA,rxFilt);

%=========================================================

% CMA引发相位旋转

% The constant modulus algorithm is useful when no training signal is available,

% and works best for constant modulus modulations such as PSK.

% However, if CMA has no additional side information, it can introduce phase ambiguity.

% For example, CMA might find weights that produce a perfect QPSK constellation but

% might introduce a phase rotation of 90, 180, or 270 degrees.

% Alternatively, differential modulation can be used to avoid phase ambiguity.

%=========================================================

rxCma = symbolcma(nWeights:end); %

rxCma = rxCma./mean(abs(rxCma));

scatterplot(rxCma(nWeights+1:end));

%% LMS or RLS

close all;

% rxCma = rxFilt; % 没有CMA

% eq1 = lineareq(40, rls(0.99,0.01));

eq1 = lineareq(6, rls(0.99,0.01)); % Create an equalizer object. % 40 taps,RLS算法,步长0.99,自相关矩阵逆矩阵的初值InvCorrInit

% eq1 = lineareq(10, lms(0.001)); % LMS

eq1.SigConst = step(hMod,(0:M-1)')'; % Set signal constellation. % 标准星座图

[symbolest,~] = equalize(eq1,rxCma,modmsg(1:trainlen)); % Equalize. % 均衡器obj,需要均衡的信号,训练序列

symbolest = symbolest ./ mean(abs(symbolest)) .* mean(abs(eq1.SigConst));

rxFilt_disp = rxFilt ./ mean(abs(rxFilt)) .* mean(abs(eq1.SigConst));

%%

% Plot signals.

close all;

h = scatterplot(rxFilt_disp(trainlen+1:end),1,trainlen,'bx'); hold on;

scatterplot(symbolest(trainlen+1:end),1,trainlen,'r.',h);

scatterplot(eq1.SigConst,1,0,'k*',h);

legend('Filtered signal','Equalized signal',...

'Ideal signal constellation');

hold off;

%%

% a1 = symbolest(trainlen+1:end);

% a2 = modmsg;

% 之后如何计算BER就不用写了。方法非常magic。

%% 没有相位旋转的时候计算BER

% % Compute error rates with equalization.

% hDemod = comm.RectangularQAMDemodulator(M);

% demodmsg = step(hDemod,symbolest); % Demodulate detected signal from equalizer.

%

% % demodmsg

% % msg

%

% % [hicorrI,lagsiI]=xcorr(demodmsg,msg);

% % [~,offsetindex]=max((hicorrI));

% % figure;plot(lagsiI,abs(hicorrI));

%

% % Create ErrorRate Calculator System object

% serVec = step(comm.ErrorRate,msg(trainlen+1:end),demodmsg(trainlen+1:end));

% srate = serVec(1)

% snum = serVec(2)

% % Convert integers to bits

% hIntToBit = comm.IntegerToBit(log2(M));

% Tx_bit = step(hIntToBit, msg(trainlen+1:end));

% Rx_bit = step(hIntToBit, demodmsg(trainlen+1:end));

% % Calculate BER

% berVec = step(comm.ErrorRate,Rx_bit,Tx_bit);

% brate = berVec(1)

% bnum = berVec(2)

部分代码以后公开。

100MBuad,QPSK。RRC,alpha = 0.3。

matlab qpsk调试 rls均衡,通信系统仿真速成第2天:QPSK调制与解调(实验)相关推荐

  1. bpsk调制及解调实验_无线通信中的IQ调制,BPSK调制,QPSK调制,16QAM调制的理解...

    欢迎FPGA工程师加入官方微信技术群 点击蓝字关注我们FPGA之家-中国最好最大的FPGA纯工程师社群 先从IQ调制说起: IQ调制:IQ解调原理:Linux下使用GNU Octave运行下面的代码: ...

  2. matlab显示2dpsk误码率,基于MATLAB的2DPSK低频感应通信系统仿真设计

    3 2DPSK 低频感应通信系统的仿真设计本文引用地址:http://www.eepw.com.cn/article/174634.htm 3.1 仿真设计 在通信系统的设计中,通信系统的仿真设计能够 ...

  3. MATLAB simulink 2FSK调制与解调实验,附仿真文件(西电B测)

    simulink仿真文件链接:https://download.csdn.net/download/weixin_42845306/17893972 整个报告是用LaTeX写的,摘要目录总结参考文献什 ...

  4. 2ASK、2FSK、2PSK、2DPSK、4ASK、4FSK、4PSK、4DPSK、QPSK,以及4QAM、16QAM和MSK、GMSK这些调制和解调过程

    2ASK,2FSK,2PSK,2DPSK四个二进制的仿真结论如下所示: 4ASK,4FSK,4PSK,4DPSK四个四进制的仿真结论如下所示: QPSK,4QAM,16QAM三个仿真结果如下所示: M ...

  5. 通信原理学习笔记2-1:模拟调制——相干解调的载波恢复、锁相环(平方环/Costas环)、变频/混频技术

    原始信号为基带模拟信号,要想在空气中传播信号,必须使用频带信号(频率高则天线长度降低,且可能进行频分复用等) 要产生频带信号,需要频谱搬移,这就是调制:基带信号经过调制,得到已调信号/调制信号/频带信 ...

  6. MATLAB 基础与通信系统仿真

    文章目录 第 1 章 MATLAB 基础与通信系统仿真 1.1 MATLAB 简介 1.1.1 MATLAB 的起源 1.1.2MATLAB 的特点 1.2 MATLAB 程序设计 1.2.1 MAT ...

  7. 通信MATLAB仿真毕业设计,毕业设计—基于matlab的通信系统仿真报告.doc

    毕业设计-基于matlab的通信系统仿真报告.doc 创新实践报告报 告 题 目:基于matlab的通信系统仿真学 院 名 称:信息工程学院姓 名:余盛泽班 级 学 号:指 导 老 师:温 靖二O一四 ...

  8. 【通信系统仿真设计】基于Matlab的2Q-FSK移频键控通信系统仿真

    基于Matlab的2Q-FSK移频键控通信系统仿真 前言 仿真原理 实验原理 载波 调制 接收端接收 加噪实现 解调 滤波器 滤波实现 滤波结果图 码元判决 实验结果 实验结果拟合 仿真代码 完整代码 ...

  9. matlab相干解调,心电信号的调制与解调(AM调制、相干解调)

    陈超 11108125 一. 系统构思: 1).通信原理课程介绍了模拟信号的调制与解调.调制可以实现将低频信号频谱搬移到载频位置,解调相当于 调制的反过程. 2).调制和解调的应用举例:3.4kHZ的 ...

最新文章

  1. 实现2D全景图的中心视野变换
  2. 黑色星期五Friday the Thirteenth
  3. docker 从harbor 拉取镜像慢_Harbor丨使用的正确姿势
  4. 使用VS Code开发调试.NET Core 2.0
  5. 扎克伯格预言即将成真:计算机可解读图片内容
  6. 局域网arp攻击_网络安全基础之ARP攻击和防御
  7. 彻底禁用chrome请停用以开发者模式运行的扩展程序弹框
  8. 计算几何基本知识整理
  9. 推荐:年度巨献:《Ubuntu桌面生存指南》(作者:ghosert)
  10. C++处理有道单词导出单词本
  11. 数据分析流程——业务需求分析
  12. NAT穿透的工作原理
  13. Windows Server 2012 之NIC组合(NIC Teaming)介绍
  14. h5计时器(requestAnimationFrame)
  15. 【数据库 · MySQL】听韩顺平老师课草稿
  16. 关于VS2010下编译NTL库方法及NTL库的应用
  17. Moses安装全记录
  18. codeforces 869 E. The Untended Antiquity(树状数组)
  19. sql server 2016不能全部用到CPU的逻辑核心数的问题
  20. 网站本地化翻译、建设助力企业拓展全球市场 安睿杰翻译

热门文章

  1. Linux计算节点怎么关闭,OpenStack 删除无用的计算结点
  2. WhatsApp:硅谷屌丝现世逆袭
  3. ES6读书笔记(下)
  4. 机器学习笔记(六)-神经网络:概述
  5. DSP28335:EPWM
  6. 视频编码的守望者--Jason Garrett-Glaser
  7. 类型数组HTML5 中的新数组
  8. 电力-涌流抑制与谐波
  9. C语言常见字符串函数、字符分类函数与内存函数的使用
  10. 单点故障解决方案介绍smart link/monitor link /stp