root/ResearchApps/PHY/WARPLAB/WARPLAB_SISO/M_code/warplab_processRawRxData.m

Revision 697, 1.0 kB (checked in by MelissaDuarte, 11 months ago)

Adding warplab m files

Line 
1function [RxData,RxOTR] = warplab_processRawRxData(RawRxData)
2
3%Mangle the received data
4%Each received sample is a 32-bit value:
5% [OTR_I 0 RX_I OTR_Q 0 RX_Q]
6% OTR_I/OTR_Q: UFix1_0, incidates ADC overflow
7% 0: UFix1_0, always zero
8% RX_I/RX_Q: Fix14_13, raw ADC samples
9
10rxData_I = uint16(bitshift(RawRxData, -16));
11rxData_Q = uint16(bitand(RawRxData, hex2dec('0000FFFF')));
12
13rxOTR_I = bitshift(rxData_I, -15);
14rxOTR_Q = bitshift(rxData_Q, -15);
15
16rxData_I = uint16(bitand(rxData_I, hex2dec('3FFF'))); %mask off top two bits
17rxData_Isigns = uint16(bitshift(bitand(rxData_I, hex2dec('2000')), -13)); %get sign bit
18rxData_I = double(typecast(bitor(rxData_I, rxData_Isigns*hex2dec('C000')),'int16'))./2^13;
19
20rxData_Q = uint16(bitand(rxData_Q, hex2dec('3FFF'))); %mask off top two bits
21rxData_Qsigns = uint16(bitshift(bitand(rxData_Q, hex2dec('2000')), -13)); %get sign bit
22rxData_Q = double(typecast(bitor(rxData_Q, rxData_Qsigns*hex2dec('C000')),'int16'))./2^13;
23
24RxData = complex(rxData_I, rxData_Q);
25RxOTR = complex(rxOTR_I, rxOTR_Q);
Note: See TracBrowser for help on using the browser.