⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dqpskencoder.m

📁 simulation module for visual wireless sensor network
💻 M
字号:
% ----------------------------------------------------------------------------------------------%
% DQPSKEncoder(..) - Does DQPSK Encoding.
% ----------------------------------------
% Does DQPSK Encoding of the given information bits. The actual bit to phase mapping is
% determined by the PhaseMap function, which has to be supplied by the user.
%
% Syntax :
% ---------
% function [I_Symbols, Q_Symbols] = DQPSKEncoder(BitStreamOneTx, BitStreamTwoTx)
%
% Inputs :
% --------
% 1. Input Bit streams that constitute the symbol stream.
% 2. The PhaseMap(..) function (defined by the user), that defines the mapping of the 
% phase of the modulated symbol given the input bits.
% The Syntax for defining the phase mapping function is :
% [Phase] = PhaseMap(BitOneTx, BitTwoTx)
% Where BitOneTx and BitTwoTx are the input bits and Phase is the output phase for
% the given combination of bits.
% An example PhaseMap function is given in the library to aid the user in defining this 
% function for his requirements.
% 
% Outputs:
% --------
% The Output I and Q Symbols.
% ----------------------------------------------------------------------------------------------%

function [I_Symbols, Q_Symbols] = DQPSKEncoder(BitStreamOneTx, BitStreamTwoTx)

% This is supposed to be (I(-1) + jQ(-1)).
InitialSymbol = (1+0i);
I_StreamLength = length(BitStreamOneTx);
Q_StreamLength = I_StreamLength;

% -----------------------------> Differential Modulation <------------------------------------- %
% Do the Differential Modulation and generate the baseband-complex signal.
% Calculate the phase-shift due to the first symbol.
PhaseShift(1) = PhaseMap([BitStreamOneTx(1),BitStreamTwoTx(1)]);
% The first modulated symbol.
ModulatedSymbol(1) = (InitialSymbol)*exp(i*PhaseShift(1));
% The other symbols calculated iteratively.
for index = 2:1:I_StreamLength
   % The phase shift due to the ith modulated symbol.
   PhaseShift(index) = PhaseMap([BitStreamOneTx(index),BitStreamTwoTx(index)]);
   % Rotated the modulated symbol phasor to the new position.
   ModulatedSymbol(index) = ModulatedSymbol(index-1)*exp(j*PhaseShift(index));
end

% Extract the I and Q parts of the Symbol.
I_Symbols = real(ModulatedSymbol);
Q_Symbols = imag(ModulatedSymbol);



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -