MATLAB使用眼图分析QPSK通信系统接收端匹配滤波后的信号


前言

本文完成以下内容:
(1)建立一个QPSK传输系统,并引入EsNo=20dB(SNR=0dB)的噪声,接收端对带噪信号进行匹配滤波。
(2)分别画出成形滤波器输出信号的实部波形和匹配滤波器输出信号的实部波形。
(3)分别画出成形滤波器输出信号的2D彩色眼图,和匹配滤波器输出信号的2D彩色眼图,2D彩色眼图中,颜色强度与给定时间输入信号幅度的概率密度函数(PDF)成比例。


一、MATLAB仿真代码

代码如下:

clc
clear all
close all
%% Create a QPSK transmission system
% Initialize system parameters
Fs = 10000;
Rs = 100;
nSamps = Fs/Rs;
rollOff = 0.5;
M = 4;

% comm.QPSKModulator System object
hMod = comm.QPSKModulator;

% Square root raised cosine filters
filtSpec = fdesign.pulseshaping(nSamps,'Square root raised cosine',...
    'Nsym,Beta',6,rollOff);
hTxFlt = design(filtSpec); hTxFlt.PersistentMemory = true;
hRxFlt = copy(hTxFlt); hTxFlt.Numerator = hTxFlt.Numerator*nSamps;

% Generate modulated and pulse shaped signal
msgLen = 1000;
msgData = randi([0 M-1],msgLen,1);
msgSymbols = step(hMod, msgData);
msgTx = hTxFlt.filter(upsample(msgSymbols, nSamps));

% Create an comm.AWGNChannel System object
EsNo = 20;
SNR = EsNo - 10*log10(nSamps);
hChan = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio (SNR)',...
  'SNR', SNR);
hChan.SignalPower = (msgTx' * msgTx)/ length(msgTx);

% Modulated signal through AWGN channel
msgRx = step(hChan, msgTx);

% Matched filtering
msgRxMf = hRxFlt.filter(msgRx);

%% Plot the Tx filtered in-phase signal and the Nf filtered in-phase signal
t = 0:1/Fs:50/Rs-1/Fs;
idx = round(t*Fs+1);
figure(); 
subplot(211)
plot(t, real(msgTx(idx)));
title('Modulated, filtered in-phase signal');
xlabel('Time (sec)');
ylabel('Amplitude');
grid on;

subplot(212)
plot(t, real(msgRxMf(idx)));
title(['Modulated, filtered noisy in-phase signal, Es/No = ' ...
       num2str(EsNo) ' dB']);  
xlabel('Time (sec)');
ylabel('Amplitude');
grid on;

%% eye diagram
% Create an eye diagram object
eyeObj = commscope.eyediagram(...
    'SamplingFrequency', Fs, ...
    'SamplesPerSymbol', nSamps, ...
    'SymbolsPerTrace', 2, ...
    'MinimumAmplitude', -1.5, ...
    'MaximumAmplitude', 1.5, ...
    'OperationMode', 'Complex Signal', ...
    'PlotType', '2D Color', ...
    'PlotTimeOffset', 0);

eyeObjN = copy(eyeObj);

% Update the first eye diagram object with the transmitted signal
eyeObj.update(msgTx);

% Update the second eye diagram object with the received signal
eyeObjN.update(msgRxMf);

二、仿真结果

代码运行结果画图如下:

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值