📄 mslotmeasurement.m
字号:
function [RSSI CINR FreqOff TimeOff BitShift]= mSlotMeasurement(Pilot)
% Slot Measuremnt of IEEE 802.16-2005 (WiMAX, OFDMA only)
% Input:
% Pilot -- Pilot of Symbol1 and Symbol3 for SubChannel
% Output:
% RSSI -- Channel energy combined
% CINR -- Signal to noise combine
% FreqOff -- Frequency offset combined
% TimeOff -- Time offset combined
%
% Remark:
%
% Matlab 7 Release 14 SP2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mSlotMeasurement.m.rca $
% $Revision: 1.11 $
% $Date: Mon Jan 22 14:10:23 2007 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[m,n] = size(Pilot) ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% RSSI
%%%%%%%%%%%%%%%%%%%%%%%%%%%
RSSI = 0 ;
% RSSI = sum(real(Pilot).^2 + imag(Pilot).^2 )/n;
% RSSIdB = 10*log(RSSI);
% % %make sure RSSI is the range of uint16:
% % RSSI = min( RSSI , 2^16 ) ;
% % RSSI = max( RSSI , 0 ) ;
% global rssi
% rssi(end+1)=RSSI;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CINR
%%%%%%%%%%%%%%%%%%%%%%%%%%%
CINR = 0;
% pilot_mean1 = (Pilot(1)+Pilot(2)+Pilot(13)+Pilot(14))/4;
% pilot_mean2 = (Pilot(3)+Pilot(4)+Pilot(15)+Pilot(16))/4;
% pilot_mean3 = (Pilot(5)+Pilot(6)+Pilot(17)+Pilot(18))/4;
% pilot_mean4 = (Pilot(7)+Pilot(8)+Pilot(19)+Pilot(20))/4;
% pilot_mean5 = (Pilot(9)+Pilot(10)+Pilot(21)+Pilot(22))/4;
% pilot_mean6 = (Pilot(11)+Pilot(12)+Pilot(23)+Pilot(24))/4;
%
% pilot_samples = [ pilot_mean1 pilot_mean1 ...
% pilot_mean2 pilot_mean2 ...
% pilot_mean3 pilot_mean3 ...
% pilot_mean4 pilot_mean4 ...
% pilot_mean5 pilot_mean5 ...
% pilot_mean6 pilot_mean6 ...
% pilot_mean1 pilot_mean1 ...
% pilot_mean2 pilot_mean2 ...
% pilot_mean3 pilot_mean3 ...
% pilot_mean4 pilot_mean4 ...
% pilot_mean5 pilot_mean5 ...
% pilot_mean6 pilot_mean6
% ];
%
% W = abs(pilot_samples - Pilot) ;
% CINR = sum( abs(pilot_samples).^2 )/( sum( (abs(Pilot-pilot_samples)).^2 )) ;
% % %make sure CINR is the range of uint16:
% % CINR = min( CINR , 2^16 ) ;
% % CINR = max( CINR , 0 ) ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% BitShift
%%%%%%%%%%%%%%%%%%%%%%%%%%%
BitShift = 0; % dummy output
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Time Offset
%%%%%%%%%%%%%%%%%%%%%%%%%%%
sumdiffatsi13 = 0;
PilotArg = angle(double(Pilot));
NTile=6;
sumdiffatsi13 = PilotArg(2) - PilotArg(1) + PilotArg(4) - PilotArg(3) + ...
PilotArg(6) - PilotArg(5) + PilotArg(8) - PilotArg(7) + ...
PilotArg(10) - PilotArg(9) + PilotArg(12) - PilotArg(11) + ...
PilotArg(14) - PilotArg(13) + PilotArg(16) - PilotArg(15) + ...
PilotArg(18) - PilotArg(17) + PilotArg(20) - PilotArg(19) + ...
PilotArg(22) - PilotArg(21) + PilotArg(24) - PilotArg(23);
TimeOff = sumdiffatsi13/(3*2*NTile);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% Frequency Offset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FreqDataSlotOff = 0;
Ntiles = 6;
Ts = 91.4; % This is an input value
% Assume Pilot is a 24 entries vector and arranged as below
% P111 P141 P112 P142 P113 P143 P114 P144 P115 P145 P116 P146 ...
% P311 P341 P312 P342 P313 P343 P314 P344 P315 P345 P316 P346
FreqDataSlotOff = PilotArg(13) - PilotArg(1) + PilotArg(14) - PilotArg(2) + ...
PilotArg(15) - PilotArg(3) + PilotArg(16) - PilotArg(4) + ...
PilotArg(17) - PilotArg(5) + PilotArg(18) - PilotArg(6) + ...
PilotArg(19) - PilotArg(7) + PilotArg(20) - PilotArg(8) + ...
PilotArg(21) - PilotArg(9) + PilotArg(22) - PilotArg(10) + ...
PilotArg(23) - PilotArg(11) + PilotArg(24) - PilotArg(12);
FreqDataSlotOff = FreqDataSlotOff/(2*2*Ntiles);
% Sum FreqDataSlotOff for Nslot to get the frequency offset measurement
% over user data burst in Hz
FreqOff = FreqDataSlotOff;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Bit shift
%%%%%%%%%%%%%%%%%%%%%%%%%%%
BitShift = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -