1、ofdm中的ls算法LS algorithm in OFDMofdm中的ls算法(LS algorithm in OFDM)基于梳状导频的ofdm信道估计% ifft_bin_length:和的点数IFFT FFTcarrier_count:子载波个数%bits_per_symbol:每符号上的比特数% symbols_per_carrier:每桢的OFDM符号数X:欲发送的二进制比特流%清除所有;中图分类号;ifft_bin_length = 128;%和的点数IFFT FFTcarrier_count = 100;% % %子载波个数bits_per_symbol = 2;%每符号上的比特
2、数symbols_per_carrier = 12;%每桢的OFDM符号数李= 7;%导频之间的间隔NP =细胞(carrier_count /里县)+ 1;% % 1导频数加的原因:使最后一列也是导频n_number = carrier_count * * bits_per_symbol symbols_per_carrier;载体= 1:carrier_count +NP;GI = 8;%保护间隔长度n_snr = 25;%每比特信噪比信噪比= 5;%信噪比间隔% symbols_per_carrier *(ifft_bin_length + GI)% -%向量初始化X =零(1,n_nu
3、mber); ;x2 ;X3 = ;X4 = ;X5 = ;X6 = ;X7 = ;Y1 = ;Y2 = ;Y3 = ;Y4 = ;Y5 = ;Y6 = ;Y7 = ;XX =零(1,n_number);dif_bit =零(1,n_number);dif_bit1 =零(1,n_number);dif_bit2 =零(1,n_number);dif_bit3 =零(1,n_number);randint(x = 1,n_number);%产生二进制随即序列(非0即1)% -%的QPSK调制:(1 1)-4;(0,1)- 34;(0,0)- 34;(1,0)- -/ 4;S =(X2-1)/
4、sqrt(2);S = S(1:2:n_number);图像= S(2:2:n_number);X1 = S + J *图像;% -%产生随机导频信号% -train_sym = randint(1,2 symbols_per_carrier);T =(train_sym。* 2-1)/ sqrt(2);请= T(1:2:2 * symbols_per_carrier);图像= T(二时02分02秒* symbols_per_carrier);training_symbols1 =治疗+ J *图像;training_symbols2 = training_symbols1。”;trainin
5、g_symbols = repmat(training_symbols2,1,NP);%显示(training_symbols)试验1:李+ 1 = carrier_count +NP;如果长度(导频)= NP飞行员= 试点,carrier_count +名词;结束% -%串并转换X2 =重塑(X1,carrier_count,symbols_per_carrier)。”;% -%插入导频信号= 1:carrier_count +NP;信号(导频)= ;X3(:,飞行员)= training_symbols;X3(:,信号)= x2;% X3 =猫(1,training_symbols,X2)
6、;ifft_modulation =零(symbols_per_carrier,ifft_bin_length);ifft_modulation(:,携带者)= x3;% ifft_modulation(:,conjugate_carriers)=连词(X3);X4 = IFFT(ifft_modulation,ifft_bin_length,2);%X5=X4.;% plus protection interval (cyclic prefix)For k=1:symbols_per_carrier;For i=1:IFFT_bin_length;X6 (k, i+GI) =X4 (k, I
7、);EndFor i=1:GI;X6 (k, I) =X4 (k, i+IFFT_bin_length-GI);EndEnd%-% parallel string conversionX7=reshape (X6., 1, symbols_per_carrier* (IFFT_bin_length+GI);% f=100; r=pi/6;% for n=1:length (X7)% a (n) =cos (2*pi*n) /8);% a (n) =exp (i* (2*pi*f*n) / (8*length (X7) +r);%c=X7.*a (n);% end% b=real (X7.*a)
8、;% m1=xcorr (b (?), 1:136);% m2=xcorr (b (?), 137:272);%a=zeros (1000271);%for i=1:1000% b=xcorr (X7 (?), 1:136);% c=xcorr (X7 (?), 137:272);% a (I,:) =b;%end%-% channel model: Rayleigh fading channel with Doppler shiftFd=100;% Doppler frequency shiftR=6;% multipath numberA=0.123 0.3 0.4 0.5 0.7 0.8
9、;% multipath amplitudeD=2 3459 13;% diameter delayT=1;% system sampling periodTh=90 072144216 288*pi./180;% phase shiftH=ones (1, carrier_count);Hh=;For k=1:r%deta=zeros (1, D (k) -1), 1, zeros (1, carrier_count-d (k);H1=a (k) *exp (j* (2*pi*T*fd*d (k) /carrier_count);%h1=a (k) *exp (j* (2*pi*T*fd*d
10、 (k) /carrier_count);Hh=hh, h1;EndH (d+1) =hh;%noise=randn (1, length (X7) +j.*randn (1, length (X7);%-Channel1=zeros (size (X7);Channel1 (1+d (1): length (X7) =hh (1) *X7 (1:length (X7) -d (1);Channel2=zeros (size (X7);Channel2 (1+d (2): length (X7) =hh (2) *X7 (1:length (X7) -d (2);Channel3=zeros
11、(size (X7);Channel3 (1+d (3): length (X7) =hh (3) *X7 (1:length (X7) -d (3);Channel4=zeros (size (X7);Channel4 (1+d (4): length (X7) =hh (4) *X7 (1:length (X7) -d (4);Channel5=zeros (size (X7);Channel5 (1+d (5): length (X7) =hh (5) *X7 (1:length (X7) -d (5);Channel6=zeros (size (X7);Channel6 (1+d (6
12、): length (X7) =hh (6) *X7 (1:length (X7) -d (6);%-Tx_data=X7+channel1+channel2+channel3+channel4;%-%-%-% plus Gauss white noiseError_ber=;% bit error rateError_ber1=;Error_ber2=;% bit error rateError_ber3=;Error_ber11=;%Error_ser=;% symbol error rateFor snr_db=0:snr:N_snr% code_power=0;% code_power
13、=norm (Tx_data)2/ (length (Tx_data);Symbol power of the% signal%bit_power=var (Tx_data);% bit_power=code_power/bits_per_symbol;% bit power% noise_power=10*log10 (bit_power/ (10 (snr_db/10)% noise power% noise=wgn (1, length (Tx_data), noise_power,complex);% produces GAUSS white noise signalVn=randn
14、(1, symbols_per_carrier* (IFFT_bin_length+GI) +sqrt (-1) *randn (1, symbols_per_carrier* (IFFT_bin_length+GI);Vn=vn/norm (VN) *10 (-snr_db/20) *norm (Tx_data);Y7=Tx_data+vn;%-% string merge transformationY6=reshape (Y7, IFFT_bin_length+GI, symbols_per_carrier);Y6_1=reshape (Tx_data, IFFT_bin_length+
15、GI, symbols_per_carrier);% to protect intervalsFor k=1:symbols_per_carrier;For i=1:IFFT_bin_length;Y5 (k, I) =Y6 (k, i+GI);Y5_1 (k, I) =Y6_1 (k, i+GI);EndEndY4=fft (Y5, IFFT_bin_length, 2);Y3=Y4 (: carriers);Y4_1=fft (Y5_1, IFFT_bin_length, 2);Y3_1=Y4_1 (: carriers);%-%LS channel estimationH=;Y2=Y3
16、(: signal);Y2_1=Y3_1 (: signal);Rx_training_symbols=Y3 (: pilot);Rx_training_symbols_1=Y3_1 (: pilot);Rx_training_symbols0=reshape (Rx_training_symbols, symbols_per_carrier*Np, 1);Rx_training_symbols0_1=reshape (Rx_training_symbols_1, symbols_per_carrier*Np, 1);Training_symbol0=reshape (training_sym
17、bols, 1, symbols_per_carrier*Np);Training_symbol0_1=reshape (training_symbols, 1, symbols_per_carrier*Np);Training_symbol1=diag (training_symbol0);Training_symbol1_1=diag (training_symbol0_1);%disp (training_symbols)Training_symbol2=inv (training_symbol1);Hls=training_symbol2*Rx_training_symbols0;Hl
18、s1=reshape (Hls, symbols_per_carrier, Np);HLs=;HLs1=;If ceil (carrier_count/LI) =carrier_count/LIFor k=1:Np-1HLs2=;For t=1:LIHLs1 (=: 1) = (Hls1 (?), k+1) -Hls1 (?), K) * (t-1)./LI+Hls1 (k);HLs2=HLs2, HLs1;EndHLs=HLs, HLs2;EndElseFor k=1:Np-2HLs2=;For t=1:LIHLs1 (=: 1) = (Hls1 (?), k+1) -Hls1 (?), K
19、) * (t-1)./LI+Hls1 (k);HLs2=HLs2, HLs1;EndHLs=HLs, HLs2;EndHLs3=;For t=1:mod (carrier_count, LI)HLs1 (=: 1) = (Hls1 (?), Np) -Hls1 (?), Np-1) * (t-1)./LI+Hls1 (Np-1);HLs3=HLs3, HLs1;End;HLs=HLs, HLs3;End%Hls1=Hls.;training_symbol2_1 = inv(training_symbol1_1);hls_1 = training_symbol2_1 * rx_training_
20、symbols0_1;hls1_1 =重塑(hls_1,symbols_per_carrier,NP);hls_1 = ;hls1_1 = ;如果细胞(carrier_count /李)= = carrier_count /里县K = 1:NP-1hls2_1 = ;对于t = 1:李hls1_1(:,1)=(hls1_1(:,K + 1)- HLS1(:,k)*(t-1)。/李+ HLS1(:,k);hls2_1 = hls2_1,hls1_1 ;结束hls_1 = hls_1,hls2_1 ;结束其他的K = 1:NP-2hls2_1 = ;对于t = 1:李hls1_1(:,1)=(hl
21、s1_1(:,K + 1)- hls1_1(:,k)*(t-1)。/锂离子hls1_1(:,k);hls2_1 = hls2_1,hls1_1 ;结束hls_1 = hls_1,hls2_1 ;结束hls3_1 = ;T = 1:MOD(carrier_count,李)hls1_1(:,1)=(hls1_1(:,NP)- hls1_1(:,NP-1)*(t-1)。/锂离子hls1_1(:,NP-1);hls3_1 = hls3_1,hls1_1 ;结束;hls_1 = hls_1,hls3_1 ;结束% h = repmat(HLS1,symbols_per_carrier,1);%将导频扩展
22、成symbols_per_carrier * carrier_count矩阵Y1,Y2,HLS;h_2 = IFFT(HLS,100,2);h_3 =零(12100);h_3(:,1:8)= h_2(:,1:8);h_4 = FFT(h_3100,2);% h_2_1 = IFFT(hls_1,ifft_bin_length,2);Y11 = Y2。/ h_4;% Y11 = Y2。/% -% -%并串变换YY =重塑(Y2。,1,n_number / bits_per_symbol);YY1 =重塑(Y1。,1,n_number / bits_per_symbol);yy11 =重塑(Y11
23、。,1,n_number / bits_per_symbol);% -QPSK解调%y_real =符号(房(YY);y_image =符号(图像(YY);y_re = y_real / sqrt(2);y_im = y_image / sqrt(2);y_real1 =符号(房(YY1);y_image1 =符号(图像(YY1);y_re1 = y_real1 / sqrt(2);y_im1 = y_image1 / sqrt(2);y_real11 =符号(房(yy11);y_image11 =符号(图像(yy11);y_re11 = y_real11 / sqrt(2);y_im11 =
24、 y_image11 / sqrt(2);r00 = ;R01 = ;R10 = ;R11 = ;R110 = ;R111 = ;K = 1:长度(y_real);r00 = r00, y_real(K),y_image(K) ;结束;K = 1:长度(y_real1);R10 = R10, y_real1(K),y_image1(K) ;结束;K = 1:长度(y_real11);R110 = R10, y_real11(K),y_image11(K) ;结束;K = 1:长度(y_re);R01 = R01, y_re(K),y_im(K) ;结束;K = 1:长度(y_re1);R11
25、= R11, y_re1(K),y_im1(K) ;结束;K = 1:长度(y_re11);R111 = R111,y _ re11 (k), and _ im1 (k);end;% xx (find (r01 0) = 1;% -% 计算在不同信噪比下的误比特率并作图the _ bits = s - pl1.the _ date) = s - r11.the _ bit11 = s - r111;on _ snr = 0% 纪录误比特数for k = 1: n _ number;if the _ bits (k) = 0;on _ snr = on _ snr + 1;endend;on _
26、 snr1 = 0% 纪录误比特数for k = 1: n _ number;if the _ date) (k) = 0;on _ snr1 = on _ snr1 + 1;endendon _ snr11 = 0% 纪录误比特数for k = 1: n _ number;if the _ bit11 (k) = 0;on _ snr11 = on _ snr11 + 1;endenderror _ ber = error _). the _ snr;error _ ber1 = error _ ber1. the _ snr1;error _ ber11 = error _ ber11. the _ snr11;% margin = (sum (unit, 1 / 12;% mse = abs (margin (h) / (h);endon = zeros (1, length (0: n _ snr snr);
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1