[1045] | 1 | %VIQ AVERAGER |
---|
| 2 | viqAvgLen = 128; |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | |
---|
[1040] | 7 | NUM = 35; |
---|
| 8 | viqFilt = fir1(NUM,.1); |
---|
| 9 | |
---|
[1006] | 10 | upconv_freq = 0.25; |
---|
[1041] | 11 | downconv_freq = 0.25+1e-6; %Offset to simulator actual CFO |
---|
[1006] | 12 | |
---|
| 13 | %LSFR parameters |
---|
| 14 | txLSFR_numBits = 16; |
---|
| 15 | txLSFR_polynomials = {'3921' '8435' '4A0B' '4F1D' '2835' '9A0B'}; |
---|
| 16 | txLSFR_initValues = {'3F' '1B' '03' '35' '17' '0A'}; |
---|
| 17 | |
---|
| 18 | modConstellation_prec = 8; |
---|
| 19 | modConstellation_bp = 7; |
---|
| 20 | |
---|
| 21 | %QPSK constellation |
---|
| 22 | %2 bits per symbol, 1 bit per I/Q |
---|
| 23 | % I = MSB, Q = LSB |
---|
| 24 | modConstellation_qpsk = [1 -1]; %[1 -1] |
---|
| 25 | %modConstellation_qpsk = (1-2^-modConstellation_bp).*modConstellation_qpsk./(max(abs(modConstellation_qpsk))); |
---|
| 26 | |
---|
| 27 | %16-QAM constellation |
---|
| 28 | %4 bits per symbol, 2 bits per I/Q |
---|
| 29 | % I = 2MSB, Q = 2LSB |
---|
| 30 | modConstellation_qam16 = [1 3 -1 -3]; |
---|
| 31 | modConstellation_qam16 = (1-2^-modConstellation_bp).*modConstellation_qam16./(max(abs(modConstellation_qam16))); |
---|
| 32 | |
---|
| 33 | %64-QAM constellation |
---|
| 34 | %6 bits per symbol, 3 bits per I/Q |
---|
| 35 | % I = 3MSB, Q = 3LSB |
---|
| 36 | modConstellation_qam64 = [3 1 5 7 -3 -1 -5 -7]; |
---|
| 37 | modConstellation_qam64 = (1-2^-modConstellation_bp).*modConstellation_qam64./(max(abs(modConstellation_qam64))); |
---|
| 38 | |
---|
| 39 | bndwdth = 1/5500; |
---|
| 40 | theta_0= 2*pi*bndwdth; |
---|
| 41 | eta=sqrt(2)/2; |
---|
| 42 | |
---|
| 43 | k_i= (4*theta_0*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 44 | k_p= (4*eta*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 45 | |
---|
| 46 | carrierRec_filt_K = .5 %01 |
---|
| 47 | carrierRec_filt_KP = k_p%g*(4*eta*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 48 | carrierRec_filt_KI = k_i%g*(4*theta_0*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | bndwdth = 1/1000; |
---|
| 52 | theta_0= 2*pi*bndwdth; |
---|
| 53 | eta=sqrt(2)/2; |
---|
| 54 | |
---|
| 55 | k_i= (4*theta_0*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 56 | k_p= (4*eta*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 57 | |
---|
| 58 | timingRec_filt_KP = k_p %g*(4*eta*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 59 | timingRec_filt_KI = k_i %g*(4*theta_0*theta_0)/(1+2*eta*theta_0+theta_0*theta_0); |
---|
| 60 | timingRec_filt_K = 1 |
---|
| 61 | |
---|
| 62 | mf = rcosfir(.3, 4, 8, 1,'sqrt'); |
---|
| 63 | dmf = conv(mf,[-1 0 1]); |
---|
| 64 | dmf = dmf(2:end-1); |
---|
| 65 | |
---|
| 66 | symbolRomLen = 2^13; |
---|
| 67 | symbolRom = floor(rand(1,2^13) * 4); |
---|
| 68 | |
---|
| 69 | %%%%Register Init%%%% |
---|
| 70 | %Transmitter Setup |
---|
| 71 | dac1Sel = 2; |
---|
| 72 | dac2Sel = 2; |
---|
| 73 | dac3Sel = 0; |
---|
| 74 | txModSel = 1; |
---|
| 75 | temp = fi(upconv_freq,0,32,32); |
---|
| 76 | upConv = str2num(temp.dec); |
---|
| 77 | |
---|
| 78 | %Receiver Setup |
---|
| 79 | initialDelay = 0; |
---|
| 80 | cfoReset = 0; |
---|
| 81 | cfoEnable = 1; |
---|
[1040] | 82 | cost = 1; |
---|
| 83 | benefit = 1; |
---|
[1006] | 84 | temp = fi(carrierRec_filt_K,0,32,25); |
---|
| 85 | cfoK = str2num(temp.dec); |
---|
| 86 | temp = fi(carrierRec_filt_KP,0,32,32); |
---|
| 87 | cfoKP = str2num(temp.dec); |
---|
| 88 | temp = fi(carrierRec_filt_KI,0,32,32); |
---|
| 89 | cfoKI = str2num(temp.dec); |
---|
| 90 | timingReset = 0; |
---|
| 91 | temp = fi(timingRec_filt_K,0,32,29); |
---|
| 92 | timingK = str2num(temp.dec); |
---|
| 93 | temp = fi(timingRec_filt_KP,0,32,32); |
---|
| 94 | timingKP = str2num(temp.dec); |
---|
| 95 | temp = fi(timingRec_filt_KI,0,32,32); |
---|
| 96 | timingKI = str2num(temp.dec); |
---|
| 97 | rxInputSel = 2; |
---|
| 98 | temp = fi(downconv_freq,0,32,32); |
---|
| 99 | downConv = str2num(temp.dec); |
---|
| 100 | %%%%%%%%%%%%%%%%%%%%% |
---|
| 101 | |
---|