通过信道优化数据传输的通信链路的实现(Matlab代码实现)

           目录

💥1 概述

📚2 运行结果

🎉3 参考文献

👨‍💻4 Matlab代码


💥1 概述

  • 在 MATLAB 中设计并仿真通信链路

  • 优化的通信链路以满足所需的误码率 (BER)。

  • 通过通道最大化总数字比特率。

📚2 运行结果

 

 

 

🎉3 参考文献

[1]孙颖. 无人机辅助的无线传感器网络数据传输研究[D].南京邮电大学,2022.DOI:10.27251/d.cnki.gnjdc.2022.000644.

👨‍💻4 Matlab代码

主函数部分代码:

clear all;close all;clc     % Reset workspace

%% Set Simulation Parameters

numIter = 5;  % The number of iterations of the simulation.
nSym = 1000;    % Constraint: Max 1000 symbols per packet

SNR_Vec = 0:2:16;   % Vector that stores the Signal-to-Noise Ratios
lenSNR = length(SNR_Vec);   % Length of SNR Vector
BER_Vec = zeros(numIter, lenSNR);   % Vector that stores the BER computed during each iteration

%% Set BER/Bitrate Experimental Parameters

% Modulation order
% M = 4;      % 4-QAM
M = 16;     % 16-QAM
% M = 32;     % 32-QAM

% Number of equalizer training symbols
% trainlen = 200;
trainlen = 100;
% trainlen = 50;

% Set Equalizer step size
% step = 0.01;      % 4-QAM
step = 0.001;    % 16-QAM

% Results:
% Optimized system: 16 QAM, 100 training symbols, 2.5778 bitrate 
%% Set Communication System Parameters

k = log2(M);    

% Reed-Solomon Parameters
N = 15;  % Codeword length
L = 10;  % Message length
S = 39;  % Shortened message length
cRate = L/N; % Code rate

% Set channel
chan = [1 .2 .4]; % Somewhat invertible channel impulse response, Moderate ISI

%% Create objects
% Equalizer
Equalizer = dfe(5,3,lms(step));    % Decision Feedback / LMS - Best performing equalizer
% Equalizer = lineareq(6,rls(0.99,0.1));  % Linear/RLS - Good performance
% Equalizer = lineareq(8, lms(0.01));   % Linear/LMS - Worst performance, but also meets specifications

% Configure Equalizer
Equalizer.SigConst = qammod(((0:M-1)'),M)'; % Set ideal signal constellation.
Equalizer.ResetBeforeFiltering = 0; % Resets equalizer before use

% Reed-Solomon Encoder and Decoder
rsEncoder = comm.RSEncoder(N,L,'BitInput',true);
rsDecoder = comm.RSDecoder(N,L,'BitInput',true);

%% Run simulation (numIter times)

for i = 1:numIter
    
    bits = randi(2,[nSym*k, 1])-1;  % Generate random binary data for each iteration

    for j = 1:lenSNR % Perform one iteration of the simulation at each SNR Value
        
        encMsg = rsEncoder(bits);                  % RS encode
 
        tx = qammod(encMsg,M,'InputType','bit');    % Modulate signal
        
        % Draw and apply channel
        if isequal(chan,1)
            txChan = tx;
        elseif isa(chan,'channel.rayleigh')
            reset(chan) % Draw a different channel each iteration
            txChan = filter(chan,tx);
        else
            txChan = filter(chan,1,tx);  % Apply the channel to transmitted signal. 
        end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值
>