msbcrandomizer.m

来自「OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有」· M 代码 · 共 72 行

M
72
字号
%***************************************************************************
%  802.16-2004 OFDMA PHY - mDataModulation
%
%           OutTPTx = mSbcRandomizer(inp , wk, SymbolIndex)
%
%    Description: % This function receives two OFDMA symbols
%                   with data and pilot values organized in 2
%                   vectors of Nused-1 carriers. The data
%                   is modulated using PRBS sequence which is
%                   generated by the mGenPRBS function.
%                   In the modulation the OFDMA symbol index is taken
%                   into account. The DC carrier is added before modulation.
%    Input:
%           SymbolIndex: The index of the first (out of 2 input) OFDMA
%                       symbols within the frame. This index is usefull to
%                       decide on even or odd cluster structure to start
%                       with.
%
%           inp:        Two OFDMA symbols with data and pilot
%                       located at the physical carriers (one OFDM symbol
%                       per column)
%
%           wk:         PRBS sequence ( +/- 1 )
%
%     Output:
%           OutTPTx:    Modulated data, pilot and DC subcarriers
%
%    Functions:
%                N/A
%
%    Data Files:
%                N/A
%
%***************************************************************************

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: mSbcRandomizer.m.rca $
%  $Revision: 1.5 $
%  $Date: Mon Dec 11 14:35:06 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%-- Matlab files used by this file
%-- End of list


function OutTPTx = mSbcRandomizer(inp , wk, SymbolIndex);

[m,n] = size(inp);
if mod(m,2)
    error('Error: Input vector length should be even.');
end

%add DC carrier
inp = [inp(1:m/2,:); zeros(1,n); inp(m/2+1:m,:)];

%modulation per OFDM symbol
for s=1:n
    offset = mod(s-1+SymbolIndex,32);
    temp(:,s) = complex(int16(real(wk(offset+(1:m+1)))).*real(inp(:,s))+ ...
        - int16(imag(wk(offset+(1:m+1)))).*imag(inp(:,s)), ...
        int16(imag(wk(offset+(1:m+1)))).*real(inp(:,s))+ ...
        int16(real(wk(offset+(1:m+1)))).*imag(inp(:,s)));
end

%output class is equal to input class
OutTPTx = zeros(m+1,n,class(inp));
OutTPTx(:,:) = temp;

⌨️ 快捷键说明

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