-
大小: 6KB文件类型: .m金币: 1下载: 0 次发布日期: 2021-05-14
- 语言: Matlab
- 标签: 物理层 MATLAB IEEE802.11b
资源简介
物理层DBPSK的MATLAB仿真,可运行!注释为英文标注。
代码片段和文件信息
%% 802.11b 1Mbps PHY link.
% This M code simulates DBPSK modulation and barker code spreading
% on a perfectly synchonized 802.11b link. It calculates the BER
% rate at each EsNo (EbNo) and plots the result.
%% Simulation parameters
% For each BER loop we specify the number of packets to transmit the packet size and
% the range of channel EsNo values to test.
EsNoRange=[0:2:10]; % Range of noice levels to calculate BER
NumPackets=2;
PacketSizeBytes=1024;
PacketSizeBits=PacketSizeBytes*8; % Here we ignore preamble and sync bits
clear BERResults;
%% System parameters and constants
% Specify a number of system constants.
% Spreading parameters
Barker=[1 -1 1 1 -1 1 1 1 -1 -1 -1]‘; % Barker sequence
SpreadingRate=length(Barker); % Spreading rate
% Upsampling rate
SamplesPerChip=8;
% Filter order and coefficients - root raised cosine
FilterOrder=40; % Set to multiple of SamplesPerChip to make delay calculation easy
h=firrcos(FilterOrder7e6.788e6‘rolloff‘‘sqrt‘FilterOrder/2kaiser(FilterOrder+11));
%% Delay calculation
% Calclate (specify) the net number of bits delay in the link due
% to the filtering.
%
% * samples_delay = 2 filters x (40 coeffs / 2) = 40 samples
% * chips_delay = sample_delay/SamplesPerChip = 40/8 = 5 chips
% * Must recalculate delay if you change any of these parameters
% We must delay the signal 6 more chips to align it with the 11 chip
% boundary. This results in an 11 chip delay or one symbol/bit delay.
% You must recalculate total and additional delay if you change any of these
% parameters
BitDelay=1;
ChipDelayAdd=6;
%% Main BER loop
% Calculates the BER for each EsNo level.
NumEsNos=length(EsNoRange);
disp(‘ ‘);disp(‘Start Simulation‘);
for EsNoIndex =1:NumEsNos
EsNo=EsNoRange(EsNoIndex);
disp([‘Simulating: EsNo=‘ num2str(EsNo) ‘dB‘]);
SNR=EsNo+10*log10(1/SpreadingRate)+10*log10(1/SamplesPerChip);
% Initialize system and simulation measurements state
% Bits
TotalBits=logical(0); % Bit count for BER calculation
ErrorBits=logical(0); % Error count for BER calculation
LastTxSymbol=1; % Set DBPKS Modulator state
LastRxSymbol=1; % Set DBPKS Demodulator state
% Filters
Rx_chips_delayed_store=zeros(ChipDelayAdd1);
Tx_bits_delayed_store=logical(zeros(BitDelay1));
Tx_Filter_State=h(1:end-1); % Fill filter with a +1 symbol
Rx_Filter_State=h(1:end-1); % Fill filter with a +1 symbol
% Main simulation loop
% Each packet is transmitted and the recieved bits compared with the
% transmitted bits to calculate the BER.
for Packet=1:NumPackets
% Construct frame of bits
Tx_bits=rand(PacketSizeBits1)>.5; % Random bits
% Modulate
Tx_bits_bp=(1-2*Tx_bits); % Convert to bipolar 01 --> 1 -1
Tx_symbols=LastTxSymbol*cumprod(Tx_bits_bp); % New DBPSK sym
相关资源
- MATLAB模型文件-永磁同步电机变频调速
- MIMO_OFDM联合仿真的matlab 源程序很完整
- 基于Matlab的导弹飞行动力学仿真模型
- DFT Matlab代码
- matlab求最小矩形
- matlab的FIR滤波器设计
- 5/3小波的分解与重构Matlab
- LDPC编码matlab
- 船舶一阶野本Nomoto模型
- matlab使用TCP/IP Server Sockets
- 反步法的Matlab程序
- 简单易理解的霍夫曼编码matlab程序
- 快速可靠的噪声估计程序(matlab程序
- Matlab分水岭法分割图像代码
- Matlab 简单迭代法
- 基于Matlab的FIR数字滤波器的设计与仿
- 柴油机matlab仿真
- 白化滤波器Matlab
- QC_LDPC 校验矩阵构造函数matlab
- 离散相似法仿真控制系统
- matlab四节点矩形刚度矩阵代码
- Matlab实现有限差分法解二维热传导问
- matlab制作的自动控制原理的GUI界面
- 用摄像头在MATLAB上录制avi格式视频
- 使用matlab的验证码识别
- OFDM瑞利衰落信道下的MATLAB程序
- GSA引力搜索算法MATLAB源码,中文详细
- SA模拟退火MATLAB代码详细中文注解
- matlab 目标检测算法
- matlab下的幂律拟合函数
评论
共有 条评论